Knowledgebase

The php session save path /var/cpanel/php/sessions/alt-phpXX is not writable

The error message you provided indicates that the PHP session save path is not writable. This means that PHP is unable to write session data to the specified directory.

Here's what you can do to address this issue:

  1. Check Directory Permissions:

    • Ensure that the directory /var/cpanel/php/sessions/alt-phpXX (where XX is the PHP version) has the correct permissions. It should be writable by the web server user.
    bash

 

  • sudo chmod -R 733 /var/cpanel/php/sessions/alt-phpXX
  • Verify Ownership:

    • Confirm that the directory is owned by the correct user and group. It should be owned by the user and group that the web server runs as (commonly www-data on Apache).
    kotlin
  • sudo chown -R www-data:www-data /var/cpanel/php/sessions/alt-phpXX
  • SELinux or AppArmor:

    • If you're using SELinux or AppArmor, ensure that it's not preventing PHP from writing to the session directory. You may need to adjust the policies.
  • Verify PHP Configuration:

    • Check your PHP configuration (php.ini file) to make sure that the session save path is correctly set. It should point to /var/cpanel/php/sessions/alt-phpXX.
    Arduino
  • session.save_path = "/var/cpanel/php/sessions/alt-phpXX"
  • Restart Web Server and PHP:

    • After making changes, restart your web server and PHP for the changes to take effect.
     
  • sudo service apache2 restart
  • Check Disk Space:

    • Ensure that there is enough free disk space on the server. If the disk is full, it can prevent PHP from writing session data.
  • Verify PHP Module:

    • Make sure that the PHP module responsible for handling sessions is installed and enabled.
  • Clear Session Files:

    • If there are existing session files in the directory, it might be causing issues. Clear out any old session files.
    bash

 

  1. sudo rm -rf /var/cpanel/php/sessions/alt-phpXX/*
  2. Check cPanel and PHP-FPM:

    • If you're using cPanel, ensure that PHP-FPM is configured correctly. This can sometimes affect session handling.
  3. Contact Hosting Provider or System Administrator:

    • If you're still experiencing issues, it's possible that there may be server-specific configurations or restrictions imposed by your hosting provider. Contact them for further assistance.

Always exercise caution when making changes to system configurations, and ensure that you have backups in place before making any major adjustments.

 
  • 0 Users Found This Useful
Was this answer helpful?