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

Created:

2016-11-16 13:03:21 UTC

Modified:

2017-04-26 12:40:52 UTC

5

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

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 12.0 for Linux

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

2 Comments

  • 0
    Avatar
    Soni Vimal

    I am suffering from the same issue and I use CentOs system. I cross check session.save_path through phpinfo(); it shows /var/lib/php/session.

    I rest the permissions for it but still the issue is active. please help me to resolve it. 

     

  • 0
    Avatar
    Bulat Tsydenov

    @Soni, check the permissions and ownership of the folder:

    # ls -ld /var/lib/php/session
    drwx-wx-wt 2 root root 4096 Nov 6 00:32 /var/lib/php/session

    Permission should be 1733

Please sign in to leave a comment.