user1025771
user1025771

Reputation:

Failed to write session data (files)

I just ordered a vps server by a hosting party. It's a CentOS with Plesk 11. So i just installed my Zend applicaton on the server but now the error log states

[Mon Apr 15 20:48:28 2013] [warn] [client 94.210.222.87] mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Zend_Session::start() - /var/www/vhosts/ontwerp.doedels.eu/httpdocs/mvc/libraries/Zend/Session.php(Line:469): Error #2 session_start(): open(/var/www/vhosts/ontwerp.doedels.eu/tmp/sess_t2orkniqjn9rsn9m84d2clsdd1, O_RDWR) failed: Permission denied (13) Array 
[Mon Apr 15 20:48:28 2013] [warn] [client 94.210.222.87] mod_fcgid: stderr: /var/www/vhosts/ontwerp.doedels.eu/httpdocs/mvc/libraries/Zend/Session.php(Line:479): Error #2 session_write_close(): open(/var/www/vhosts/ontwerp.doedels.eu/tmp/sess_t2orkniqjn9rsn9m84d2clsdd1, O_RDWR) failed: Permission denied (13) Array 
[Mon Apr 15 20:48:28 2013] [warn] [client 94.210.222.87] mod_fcgid: stderr: /var/www/vhosts/ontwerp.doedels.eu/httpdocs/mvc/libraries/Zend/Session.php(Line:479): Error #2 session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/vhosts/ontwerp.doedels.eu/tmp) Array' in /var/www/vhosts/ontwerp.doedels.eu/httpdocs/mvc/libraries/Zend/Session.php:482 

What did i try so far? I tried setting session.save_path to {DOCUMENTROOT}/tmp and {WEBSPACEROOT}/tmp this doens't seem to work.

The phpinfo function says that session.save_path = /var/www/vhosts/ontwerp.doedels.eu/tmp which is the good folder. The path exists and the folder has 777 CHMOD rights.

Work around It seems to work when i set session.save_path = {WEBSPACEROOT}/private/sess That is a folder i made with 777 chmod permissions, yet it doens't seems to be a permanent solution. Since i have to create this folder by every subscription i make.

What do i know for sure?

Upvotes: 10

Views: 35676

Answers (3)

S.M. Pat
S.M. Pat

Reputation: 311

In Plex panel go to Software > Select PHP Version > Switch to PHP Options. Set session.save_path value to /tmp

force session path plex found in https://flagon.digital/blog/others/failed-write-session-data#solution__defaultpath

Upvotes: 0

Levon
Levon

Reputation: 621

Default ownership may be incorrect on session folder: Example; php-fpm7.0 on Amazon Linux defaults to apache user. If using nginx or other need to switch the folder ownership. Also as a note you have to change the user/group setting in www.conf.

chown -R root:nginx /var/lib/php/7.0/
sed -i 's/apache/nginx/g' /etc/php-fpm-7.0.d/www.conf
service php-fpm-7.0 restart

Upvotes: 3

chandresh_cool
chandresh_cool

Reputation: 11830

You need set permission for your var directory. That seems to be the problem.

Upvotes: 7

Related Questions