Server software and configuration can vary from provider to provider, which in turn causes differences in PHP handlers and paths. If your website has hard-coded PHP handlers and paths, it might be correct for the old server but not ours.
Using an incorrect PHP handler, session path, or other PHP directives can cause various errors that might 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
Please check that the mysqli PHP extension is installed and enabled.
Or,
PHP Warning: session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_03i13, O_RDWR) failed: No such file or directory
Or,
403 ForbiddenAccess to this resource on the server is denied!
Or,
MIME type [application/x-httpd-php56] for suffix '.php' does not allow serving as static file, access denied!
Or,
PHP extension missing: You have enabled the PHP extension in "Select PHP Version/PHP.ini," but it has not been enabled, or it is missing in PHPInfo.
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
homeandpublic_htmldirectories. - 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.
Delete the following lines:
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml php_value session.save_path "/tmp" session.save_path = "/tmp" SetEnv PHPRC /home/customer/www/yourdomain.com/public_html/php.ini
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.
Correct the file path:
auto_prepend_file = '/home/path/to/directory/public_html/malcare-waf.php'
In the above line, replace /home/path/to/directory with /home/cpaneluser where cpaneluser is your cPanel username.
Step By Step Instructions
- Navigate to cPanel > Files > File Manager >
public_htmldirectory.
On DirectAdmin: System Info & Files > File Manager. - Right-click on the
.htaccessfile and click "Edit".
If you do not see the [.htaccess] file, enable "Show Hidden Files (dotfiles)" from File Manager > Settings. - Delete the following lines. They might be located in different places in your file.
AddHandler application/x-httpd-ea-php74 .php .php7 .phtmlphp_value session.save_path "/tmp"SetEnv PHPRC /home/customer/www/yourdomain.com/public_html/php.ini
*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. - Correct the file path:
auto_prepend_file = '/home/path/to/directory/public_html/malcare-waf.php'
In the above line, replace/home/path/to/directorywith/home/cpaneluserwhere cpaneluser is your cPanel username. - Repeat the above steps for the
.user.inifile in thepublic_htmldirectory.
*Your website might not have a [.user.ini] file.
In the.user.inifile, 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
.htaccessand.user.inifiles in thehomedirectory.
*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.
