• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Permission denied with session.save_path

_gmic_

New Pleskian
Hello,

I'm encountering an unusual problem regarding user permissions.

I have a site1 on a Plesk server, the session.save_path is the default one (/var/lib/php5, ower is root:root and permissions are drwx-wx-wt).
PHP is ran as an Apache module. The user Apache is www-data and it's in groups www-data, psaserv, psacln, psasb.

PHP sessions are working almost perfectly, but I have from time to time this kind of errors :
Code:
Unknown: open(/var/lib/php5/sess_kr5krp6eqov59fkd50a17ujhj1, O_RDWR) failed: Permission denied (13)

It's completly random, 95% of PHP sessions are OK, 5% return an error.

To investigate this problem, I've created a site2 with Plesk, and I've changed in the site settings the save_path option (like this solution : http://kb.odin.com/en/7056).
I have on this site2 a session.save_path set to /var/www/vhosts/site2.com/private/session
I've created this directory and set permissions to 0777, but I have the same error
Code:
Unknown: open(/var/www/vhosts/site2.com/private/session/sess_m8sv32uoaspjj3riparlnseiv2, O_RDWR) failed: Permission denied (13)

Code:
# ls -l
drwxrwxrwx 2 www-data www-data 4096 sept.  2 14:58 session

How could this directory not being writable as it have a 777 permission ?

I found many occurrences of this problem, but none of the solutions are solving my case.

Do you have any suggestions I can try ?

Thanks !
 
I think you have setup incorrect ownership for your session directory, Please try to setup correct ownership and check it


~# mkdir /var/www/vhosts/domain.tld/private/php_sess
~# chown <ftpuser>:psacln /var/www/vhosts/domain.tld/private/php_sess
~# chmod 0700 /var/www/vhosts/domain.tld/private/php_sess
 
Hello,

thank you for your answer.

I've deleted and then created the directory using the command you gave me :

Code:
ls -l /var/www/vhosts/site/private/
total 4
drwx------ 2 vincent psacln 4096 sept.  4 16:06 php_sess

Unfortunately it doesn't change anything :

Code:
[Thu Sep 04 16:16:33 2014] [error] [client X.X.X.X] PHP Warning:  Unknown: open(/var/www/vhosts/site/private/php_sess/sess_rmb2g5hke1cls2r5cm5ju8vq21, O_RDWR) failed: Permission denied (13) in Unknown on line 0
[Thu Sep 04 16:16:33 2014] [error] [client X.X.X.X] PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/vhosts/site/private/php_sess)

Something to note, I have 2 directories for my site, /var/www/vhosts/site.tld/ and /var/www/vhosts/_.site.tld/, I don't know why... Anyway I've tried with both directories, same result.
 
Back
Top