Symfony 3.1.5 警告: 会话处理程序::read(): 会话数据文件不是由您的 uid 创建的
我在Ubuntu 14.04,PHP 7.1和Vagrant 1.8.6 / VirtualBox 5.1.6管理的Apache 2.4.23堆栈上运行Symfony 3.1.5。我正在尝试使用我制作的简单控制器在前端呈现响应:
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\BrowserKit\Response;
class LandingController {
/**
* @Route("/", name="homepage")
*/
public function showAction(){
return new Response('This is the landing page!');
}
}
当我尝试通过访问我的Symfony前端时,我看到:/app_dev.php
Warning: SessionHandler::read(): Session data file is not created by your uid
500 Internal Server Error - ContextErrorException
我的Apache日志显示:
CRITICAL - Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: SessionHandler::read(): Session data file is not created by your uid" at /var/www/conan/var/cache/dev/classes.php line 366
Symfony 开发日志显示:
==> /var/www/conan/var/logs/dev.log <==
[2016-10-11 14:23:04] request.INFO: Matched route "{route}". {"route":"homepage","route_parameters":{"_controller":"AppBundle\\Controller\\LandingController::showAction","_route":"homepage"},"request_uri":"http://conan.dev/app_dev.php/","method":"GET"} []
[2016-10-11 14:23:04] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: SessionHandler::read(): Session data file is not created by your uid" at /var/www/conan/var/cache/dev/classes.php line 366 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: SessionHandler::read(): Session data file is not created by your uid at /var/www/conan/var/cache/dev/classes.php:366)"} []
鉴于这似乎是一个与会话相关的问题,我参考了会话管理的Symfony文档。它指出:
Symfony 会话与 php 不兼容.ini指令 session.auto_start = 1 此指令应在 php.ini、Web 服务器指令或 .htaccess 中关闭。
session.auto_start = 0
在 my 中,该文件由用户和组拥有:php.ini
root
$ ls -lta /etc/php/7.1/fpm/php.ini
-rw-r--r-- 1 root root 70584 Sep 30 07:29 /etc/php/7.1/fpm/php.ini
我尝试根据Symfony文档中的说明创建一个(我放在我的)中,但错误仍然存在。.htaccess
DocumentRoot
我已经搜索了几个线程和问题来寻找解决方案,但还没有找到任何东西。任何想法是什么导致这种情况?