Failed to write session data solution

Failed to write session data solution

Got a failed to write session data (files)

PHP session won't work after updating the PHP version or Plesk, cPanel web hosting control panel upgrade. You try session_start(), permission, set php.ini path and solution not work.

session.save_path solution 1

Set the session save path on shared hosting by creating a custom php.ini and include this in your file: session.save_path = "/path/to/your/folder" or set ini_set('session.save_path', '/path/to/your/folder') in your PHP file. The session folder must be under your domain/account but not accessible through a Web browser.

session.save_path solution 2

If that not work follow the next guide

  • Login into web hosting control panel with the admin user
  • Go to Plesk/cPanel > Domains > example.com > PHP Settings/Select PHP version. If you select a PHP version via cPanel, it will be the PHP version for all the websites hosted in your account
  • Go to cPanel > Software > Select PHP Version > Switch to PHP Options (allow each shared account customer to select their own PHP versions and also modify PHP parameters like ‘memory_limit‘ etc.)
  • Set session.save_path value to /tmp Click Apply and save