php - Zend_Session/Zend_Auth 随机抛出错误消息 ps_files_cleanup_dir : opendir(/var/lib/php5) failed: Permission denied (13)

标签 php zend-framework zend-auth zend-session

我目前正在使用(除其他外)Zend_Auth 开发一个新应用程序,但无论出于何种原因,此错误消息完全随机地出现在任何位置(或者它接缝)

Zend_Session::start() - /home/hannes/workspace/develop/library/Zend/Session.php(Line:480): Error #8 session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) Array

  • #0/home/hannes/workspace/develop/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
  • #1/home/hannes/workspace/develop/library/Zend/Auth/Storage/Session.php(87): Zend_Session_Namespace->__construct('Zend_Auth')
  • #2/home/hannes/workspace/develop/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()
  • #3/home/hannes/workspace/develop/library/Zend/Auth.php(141): Zend_Auth->getStorage()
  • #4/home/hannes/workspace/develop/xxxxxxx/application/controllers/AdminController.php(10): Zend_Auth->hasIdentity()
  • #5/home/hannes/workspace/develop/library/Zend/Controller/Action.php(133): AdminController->init()
  • #6/home/hannes/workspace/develop/library/Zend/Controller/Dispatcher/Standard.php(262): Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http), Array)
  • #7/home/hannes/workspace/develop/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
  • #8/home/hannes/workspace/develop/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
  • #9/home/hannes/workspace/develop/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
  • #10/home/hannes/workspace/develop/xxxxxxx/public/index.php(26): Zend_Application->run()
  • #11 {主}

最佳答案

显然,这个问题主要影响(仅?)基于 debian/ubuntu 的系统,并且与自动 session 垃圾收集有关。

The variable session.gc_probability was set to 1 in the php.ini which means there is a 1% probability for the garbage collector to run and clean up the directory /var/lib/php5 where the php sessions are stored.

Apparently this folder is not writable by www-data resulting in the mentioned error and throwing the Zend exception. Setting session.gc_probability to 0 solved the problem. The session folder is cleaned up by a cron job anyway, so no need for the php garbage collector to even run.

来自 http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage

关于php - Zend_Session/Zend_Auth 随机抛出错误消息 ps_files_cleanup_dir : opendir(/var/lib/php5) failed: Permission denied (13),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2930870/

相关文章:

php - 使用 zend search lucene 从数据库中搜索

php - 如何存储和更改 Zend_Auth session ID?

javascript - 在 Zend_Auth 中, session 过期时重定向到新页面

php - 在带字符串的 onclick 事件中需要转义什么?

php - 如何按月查询mysql上的总和字段

php - 更好地实现全局 Zend Log 实例?

zend-framework2 - Zend Framework 2 - 身份验证/ACL

php - PHP 和 JavaScript 中的字符串压缩

php - 如何获取最符合用户搜索条件的记录?

zend-framework - Zend Framework View 脚本找不到路径