5
votes

I have the following error on my projet and i tried many solutions to fix it but in vain.

Warning: SessionHandler::read(): open(/var/www/html/app/../var/sessions/prod/sess_e7382632eb312b42fc19ef3cae8c079b, O_RDWR) failed: Permission denied (13) in /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php on line 61 Warning: SessionHandler::write(): open(/var/www/html/app/../var/sessions/prod/sess_e7382632eb312b42fc19ef3cae8c079b, O_RDWR) failed: Permission denied (13) in /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php on line 69

i used those command to init my project:

  • $ HTTPDUSER=ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1
  • $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var
  • $ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var

this is my config .yml

> session:
>         handler_id:  session.handler.native_file
>         save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"

I executed chown -R whoami and chmod -R 777 on var folder wihtout any result. any help please. sorry for the english.

2
Seems it's issue of permission only. Pls check the permissions have been applied properly or notGopal Joshi
the var folder has 777 right code and i still see the problem.user6830821
May be this question can help you out stackoverflow.com/questions/39980171/…Gopal Joshi

2 Answers

5
votes

Had the Same trouble when using Vagrant (PHP-FPM 7 + Nginx) with a sync folder (/vagrant ~ default)

Solved just put

    session:
        save_path: '/tmp'

on config_dev.yml inside framework entry

Just choose some place that Nginx and PHP can read/write without permission issues.

1
votes

First step would be to go into the project director and correct the ownership if it is not correct. The command below should work if your web server is running as www-user with the group www-data

sudo chown -R www-data:www-data .

Try again, if that does not work, then open config/config.yml and look for save_path:. Change the value to save_path: /var/lib/php/sessions. I hope thats works for you.