Symptoms
Website hosted in Plesk is displayed incorrectly, shows HTTP ERROR 500, it's not possible to log in to the PHP application and/or the following error might be found on the Apache log file /var/www/vhost/system/example.com/logs/error_log
:
AH01071: Got error 'PHP message: PHP Warning: session_start(): open(/var/lib/php/session/sess_d3deadbeef8i0455babecafeuo, O_RDWR) failed: Permission denied (13) ... PHP Warning: session_start(): Failed to read session data: files (path: /var/lib/php/session) in /home/www-data/example.com/httpdocs/index.php on line 2
mod_fcgid: stderr: PHP Warning: session_start(): open(/var/lib/php/sessions/sess_g0u8u3b1j8t98v0jpjmh0gmp84, O_RDWR) failed: No such file or directory (2) ... mod_fcgid: stderr: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown on line 0
Cause
The PHP session directory is missing, has invalid permissions and/or invalid SELinux context.
Resolution
-
Go to Domains > example.com > PHP Settings and check the value of the parameter session.save_path
Note: If the
session.save_path
is not set, the session files are saved in the following locations:-
On Ubuntu or Debian OS-based:
/var/lib/php7
-
On RHEL or CentOS OS-based:
/var/lib/php/session
-
-
Connect to the server via SSH
-
Create and/or set the proper permissions to the PHP session folder. For example, if the session path is
/var/lib/php/session
:# mkdir -p /var/lib/php/session && chmod 1733 /var/lib/php/session
On RHEL or CentOS OS-based with SELinux enabled, restore the SELinux context with the following command:
# restorecon -R -v /var/lib/php/session