3

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

3
  • Have you installed vendors on your production server? Commented Sep 21, 2013 at 20:23
  • i didnt becouse its a shared host and i have limited privilages so i uploaded the vendor to production, i usually do the same for my other sites and never enconterd such problems before. Commented Sep 21, 2013 at 20:29
  • You may want to check out symfony.com/doc/current/book/installation.html specifically the part about permissions for the files then, and also verify that the file its looking for actually got uploaded. Commented Sep 21, 2013 at 20:39

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

4 Comments

If I got everything at the comments below the question right, the author has no privileges to make changes at 'his' server, because he works with a shared hosting solution.
@ztirom Yes you are right. This will work if the user has root access.
Or sudo setfacl -m apache /var/lib/php/5.5/session, if you're on PHP 5.5.
In Debian/Ubuntu $ sudo setfacl -m www-data:rwx /var/lib/php/sessions
6

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"

Comments

-1

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.

1 Comment

"I said the magic word and now it's all fixed." BTW, When leaving an answer, it would be helpful to share what you set the permissions to ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.