title: How to set up file permissions for Laravel?
body: <p>I'm using Apache Web Server that has the owner set to <code>_www:_www</code>. I never know what is the best practice with file permissions, for example when I create new Laravel 5 project.</p>
  
  <p>Laravel 5 requires <code>/storage</code> folder to be writable. I found plenty of different approaches to make it work and I usually end with making it <code>777</code> chmod recursively. I know it's not the best idea though.</p>
  
  <p>The official doc says:</p>
  
  <blockquote>
    <p>Laravel may require some permissions to be configured: folders within
    <code>storage</code> and <code>vendor</code> require write access by the web server.</p>
  </blockquote>
  
  <p>Does it mean that the web server needs access to the <code>storage</code> and <code>vendor</code> folders themselves too or just their current contents?</p>
  
  <p>I assume that what is much better, is changing the <strong>owner</strong> instead of permissions. I changed all Laravel's files permissions recursively to <code>_www:_www</code> and that made the site work correctly, as if I changed chmod to <code>777</code>. The problem is that now my text editor asks me for password each time I want to save any file and the same happens if I try to change anything in Finder, like for example copy a file.</p>
  
  <p>What is the correct approach to solve these problems?</p>
  
  <ol>
  <li>Change <code>chmod</code></li>
  <li>Change the owner of the files to match those of the
      web server and perhaps set the text editor (and Finder?) to skip
      asking for password, or make them use <code>sudo</code></li>
  <li>Change the owner of the web server to match the os user (I don't
  know the consequences)</li>
  <li>Something else</li>
  </ol>