title: Symfony permission denied
body: <p>Can anyone help me fix the below error message I'm getting? I've finally got Symfony installed on a VM and it seems to be working ok except for the fact that I'm getting occasional messages for things like this:</p>
  
  <pre><code>[1/2] ContextErrorException: Warning: SessionHandler::read(): open(/var/lib/php5/sess_d8qgvn11jdu8rfuo1f0njokc67, O_RDWR) failed: Permission denied (13) 
  </code></pre>
  
  <p>From what I've picked up from reading around, I'm thinking it's because I have a mismatch between the owner/permissions between linux and the webserver but I don't know how this would happen (I'm just taking this as fact and I don't really understand how/why to prevent making the same mistakes in the future). </p>
  
  <p>Each time I've been getting one of these errors I'm submitting a mix of the below commands to try and fix the problem but I'm guessing it's not the right way to go about it (text in brackets is my understanding/guessing of what they do):</p>
  
  <p><code>sudo chmod a+x &lt;path&gt;</code> 
  Modifies the permissions of the directory</p>
  
  <p><code>sudo chmod -R 775 &lt;path&gt;</code> 
  Similar to previous except that it SETS the permissions <code>-R</code> applies it recursively</p>
  
  <p><code>sudo chown -R &lt;usr&gt;:www-data &lt;path&gt;</code>
  Changes the owner/group of the directory/file</p>