我在生产服务器中遇到此错误.在本地服务器上一切正常.
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 [] []
Run Code Online (Sandbox Code Playgroud)
生产服务器上的php版本是5.4.16
我用PHP 5.4运行Fedora 18(使用php-fpm)+ nginx,我遇到了类似的问题.Symfony抱怨它无法创建名为/ var/lib/php/session/sess_的会话文件
我使用以下acl命令给了/ var/lib/php/session apache rwx权限,它解决了问题:
sudo setfacl -m apache_username:rwx /var/lib/php/session
Run Code Online (Sandbox Code Playgroud)
apache_username是apache,www-data取决于你的linux发行版,它也可以是一个自定义用户
小智 5
只需在 app/config/config.yml 中添加/更改这两行即可修复它:
framework:
session:
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/sessions"
Run Code Online (Sandbox Code Playgroud)