Fix incorrect PHP handler or session path

 

Using an incorrect PHP handler, session path or other PHP directives can cause various errors that might often produce vague error messages that do not directly indicate the primary issue. These errors include:

 

Error:

"Your PHP installation appears to be missing the MySQL extension which is required by WordPress"

Or,

"PHP Warning: session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_03i13, O_RDWR) failed: No such file or directory"

Note:

The exact error might be different on your website.

 

Applies To:

This guide applies to Web Hosting, Semi Dedicated Hosting, Reseller Hosting, and managed servers with CloudLinux installed.

 

Solution


Disable incorrect PHP paths (handler and session) in the .htaccess and/or .user.ini files.

  • Some websites have only one of these files in only one directory. Make sure to find the files in both home and public_html directories.

  • public_html is the default root directory for your primary domain. You can find the root directory of your additional domains in cPanel > Domains.

  • If you cannot find any of the files, enable "Show Hidden Files (dotfiles)" from File Manager > Settings.

  • You need to edit both files (if both exist) in both directories (if they exist in both directories) to disable incorrect PHP paths.

Find the following lines:

  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
  php_value session.save_path "/tmp"
  session.save_path = "/tmp"

Disable them by adding a '#' in front of the line. After disabling, they will look like the following:

#  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
#  php_value session.save_path "/tmp"
#  session.save_path = "/tmp"

 

Note:

  • Your file might have php56, php5, php81, php8, or phpXX, where XX represents a number.

  • Instead of "/tmp", you might have a different value, e.g., /var/cpanel/php/sessions/ea-php74.

 

Step By Step Instructions


  • Navigate to cPanel > Files > File Manager > public_html directory.

    On DirectAdmin: System Info & Files > File Manager.


  • Right-click on the .htaccess file and click "Edit".

    If you do not see the [.htaccess] file, enable "Show Hidden Files (dotfiles)" from File Manager > Settings.


  • Disable the following lines by adding a '#' in front of them. They might be located in different places in your file.

       AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
       php_value session.save_path "/tmp"

    *Instead of "/tmp", you might have a different value, e.g., /var/cpanel/php/sessions/ea-php74.
    *Your file might have php56, php5, php81, php8, or phpXX where XX represents a number.

    After disabling, the above lines will look like this:

    #   AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
    #   php_value session.save_path "/var/cpanel/php/sessions/ea-php74"


  • Click Save.


  • Repeat the above steps for the .user.ini file in the public_html directory.

    *Your website might not have a [.user.ini] file.

    In the .user.ini file, the session.save_path line will look like this:

    session.save_path = "/tmp"

    *Instead of "/tmp", you might have a different value, e.g., /var/cpanel/php/sessions/ea-php74.


  • Repeat the above steps for the .htaccess and .user.ini files in the home directory.

    *Your website might not have any [.htaccess] or [.user.ini] files in the [home] directory. In that case, no further action is necessary.


  • Done!

 

cPanel's MultiPHP uses the above PHP directives. We do not use MultiPHP; we use CloudLinux's PHP Selector only. Using these directives on our servers will cause errors. Using both PHP Selector and MultiPHP can also cause issues with PHP configuration and extensions.

 

  • 346 Users Found This Useful
Was this answer helpful?

Related Articles

How to reset or regenerate the .htaccess file in WordPress?

A [.htaccess] file is a configuration file that tells your server how to handle certain things on...

How to fix the 403 forbidden error in WordPress?

In this article, we will show you how to easily fix the 403 forbidden error in WordPress. What...

How to deactivate plugins when not able to access WordPress admin?

Often during troubleshooting, you may need to deactivate all plugins and activate them one by...

Fix missing MySQL extension or session error

  The most common reason for the error is using an invalid PHP handler/directive in the...

How to fix errors after migrating WordPress?

  Migrations from cPanel-based servers are usually seamless. But sometimes, a few issues might...