Symfony permission denied

12,296

Solution 1

You can take a look at http://symfony.com/doc/current/book/installation.html on "Setting up Permissions" section. It talks about app/logs and app/cache, but you can do the same on any other folder you need

Solution 2

In Symfony3, I had this error after installing symfony in a new fresh VPS, I resolved it using the already noted : chmod -R 775 for the LOG and CACHE but now for the SESSIONS folder.

chmod -R 775 var/sessions
Share:
12,296
Bendy
Author by

Bendy

Updated on June 06, 2022

Comments

  • Bendy
    Bendy almost 2 years

    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:

    [1/2] ContextErrorException: Warning: SessionHandler::read(): open(/var/lib/php5/sess_d8qgvn11jdu8rfuo1f0njokc67, O_RDWR) failed: Permission denied (13) 
    

    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).

    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):

    sudo chmod a+x <path> Modifies the permissions of the directory

    sudo chmod -R 775 <path> Similar to previous except that it SETS the permissions -R applies it recursively

    sudo chown -R <usr>:www-data <path> Changes the owner/group of the directory/file