简体   繁体   中英

ZF2 session_start() Permission denied only for some users

I have looked into this issue, but can't seem to find it where it is only happening sometimes. It looks like Warning: session_start(): failed: Permission denied (13) is very similar.

I am running Zend Framework 2 and every once in a while get errors from users, as well as errors in the log. The errors are:

[01-Jul-2015 19:57:08 UTC] PHP Warning:  session_start(): open(/tmp/sess_c8d1455ce0076596ea1e074c2c70178f, O_RDWR) failed: Permission denied (13) in /home/domain/public_html/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php on line 95
[01-Jul-2015 19:57:08 UTC] PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /home/domain/public_html/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php:95) in /home/domain/public_html/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php on line 95
[01-Jul-2015 19:57:08 UTC] PHP Warning:  session_write_close(): open(/tmp/sess_c8d1455ce0076596ea1e074c2c70178f, O_RDWR) failed: Permission denied (13) in /home/domain/public_html/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php on line 166
[01-Jul-2015 19:57:08 UTC] PHP Warning:  session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in /home/domain/public_html/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php on line 166

It is happening very rarely, and I am yet to reproduce this error myself. I have checked my /tmp/ directory and permissions are set at 777.

Is there a set location I can re-declare my session path within Zend without editing the php.ini file and where I only have to do it once for this website instead of each time I call a session?

Are you able to edit your .htaccess file? In that case do something like this:

php_value session.save_path '/path/to/session/files'

Making sure the path is outside of the public accessible root!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM