AhmadF
AhmadF

Reputation: 353

symfony2 error: sessionHandler::read()

i got this error in production server. everything is ok on local server.

request.CRITICAL: Uncaught PHP Exception ErrorException: 
Warning: SessionHandler::read(): open(C:/Inetpub/vhosts//tanur.ir/vhosts/tanur.ir/private/session\sess_3olhvc8osdevomrh72bhsra4k6, O_RDWR) 
failed: No such file or directory (2) in C:\Inetpub\vhosts\tanur.ir\httpdocs\Symfony\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy.php line 69" 
at C:\Inetpub\vhosts\tanur.ir\httpdocs\Symfony\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy.php line 69 [] []

php version is 5.4.16 on production server

Upvotes: 3

Views: 11517

Answers (3)

Ahsan
Ahsan

Reputation: 4154

I am running Fedora 18 with PHP 5.4 (using php-fpm) + nginx and I faced similar problem. Symfony was complaining that it was unable to create a session file called /var/lib/php/session/sess_

I gave apache rwx permission to /var/lib/php/session using the following acl command and it solved the problem:

sudo setfacl -m apache_username:rwx /var/lib/php/session 

apache_username is either apache, www-data depending on your linux distribution, it can be also a custom user

Upvotes: 6

shuster
shuster

Reputation: 61

just have to add/change these 2 lines in app/config/config.yml to fix it:

framework:
session:
    handler_id: session.handler.native_file
    save_path: "%kernel.root_dir%/sessions"

Upvotes: 6

AhmadF
AhmadF

Reputation: 353

i think when it comes to symfony deployment errors, in most cases the problem is permissions.

in this case i changed permission of the folder in witch sessions were being saved and now everything works fine.

Upvotes: -1

Related Questions