Failed to write session data (files). Please verify that the current setting of session.save_path is correct

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 13:03:21 UTC

Modified:

2017-02-18 19:01:32 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Failed to write session data (files). Please verify that the current setting of session.save_path is correct

Symptoms

After upgrade to Plesk 12.5 the following errors are found in Apache error_log for website:

# tail -f /opt/www/vhost/system/example.com/logs/error_log
...
mod_fcgid: stderr: PHP Warning: session_start(): open(/var/lib/php/sessions/sess_g0u8u3b1j8t98v0jpjmh0gmp84, O_RDWR) failed: No such file or directory (2) in /opt/www/vhost/example.com/httpdocs/wp-content/plugins/custom-sidebars/inc/external/wpmu-lib/inc/class-thelib.php on line 114, referer: http://example.com/
...
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 path is not properly set or directory does not exists.

Resolution

  1. Check if session.save_path is set in php configuration:

    grep session.save_path /etc/php5/apache2/php.ini
    session.save_path=/var/lib/php/sessions
  2. Make sure the directory exists and have proper permissions:

    #stat /var/lib/php/sessions

    File: "/var/lib/php/sessions"
    Size: 389120 Blocks: 768 IO Block: 4096 каталог
    Device: 806h/2054d Inode: 273014 Links: 2
    Access: (1733/drwx-wx-wt) Uid: ( 0/ root) Gid: ( 0/ root)
  3. If directory does not exists create it and set valid permissions:

    # mkdir -p /var/lib/php/sessions && chmod 1733 /var/lib/php/sessions

NOTE:

  • On Ubuntu or Debian machines, if session.save_path is not set, then session files are saved in /var/lib/php5

  • On RHEL and CentOS systems, if session.save_path is not set, session files will be saved in /var/lib/php/session

Have more questions? Submit a request
Please sign in to leave a comment.