If you are running cPanel servers, you may have heard that cPanel now offers PHP7 support.
PHP7 has become quite the popular discussion within the WordPress, website optimization Facebook groups and hosting company blogs. And now that WordPress is finally mostly PHP7 compatible, and there’s even a plugin developed to help WordPress authors check their websites for PHP7 compatibility, I felt it was time to build and test my own cPanel with PHP7 setup.
Below is what I learned in setting up PHP7 on a cPanel server for WordPress.
For the cPanel server administrator:
The actual release of PHP7 to cPanel started in early 2016. A quick search in the cPanel forums will return a good number of rather frantic support requests relating to EasyApache version 4 upgrade issues.
EasyApache 4 is a requirement for PHP7 on cPanel servers.
Suffice it to say, the EasyApache 4 upgrade in 2016 was not for the faint of heart.
Until most recently, the process for upgrading cPanel servers to allow for PHP7 has been rather problematic. On a more positive note, the situation has greatly improved since the initial release.
This video from 2015 may help:
2. Ensure all sites on server are running the latest PHP7 ready php.ini file. This can be a challenge.
php.ini cPanel hint:
The default php.ini file location for cPanel is usually located at: /usr/local/lib/php.ini
3. Educate your website clients on how to edit their php.ini file (notes below).
For the cPanel website manager:
PHP7 – Hooray!
While not a perfect test–as the plugin will likely return a number of false positives, if your update to PHP7 does generate errors, the PHP Compatibility Checker plugin may help to identify plugin incompatibilities for further testing and troubleshooting.
While a backup of your website is not fully necessary, since you may revert the PHP version back to an earlier version with a click of the Apply button, this may be a good opportunity for you to download a full backup of your website in case of future failure (better safe, right…).
Some plugins and themes may recommend custom PHP settings.
Luckily, the EasyApache 4 upgrade provides a couple of new cPanel features. The first mentioned above, MultiPHP Manager, and the second is named the MultiPHP INI Editor.
The editor mode, shown in the picture at right, gives you direct access to view or edit the settings within your php.ini file.
The php.ini file is the default configuration file for PHP. It is used to control variables such as upload sizes, timeouts, memory & resource limits, and the like.
Some WordPress themes, like Envision, may present an “Input Vars Limit” warning after upgrading to PHP7.
If this is the case, use the MultiPHP INI Editor to edit your php.ini settings to the recommended settings. But there’s a catch… I’ll explain.
Unlike .htaccess files, php.ini settings, installed within your public_html directory, are not recursive through all subdirectories. When a web server is set up, default PHP settings are set for all websites. And, in the case of WordPress 4.7 and prior versions, some themes and plugins may require custom PHP settings, which can only be read from the php.ini file located within the /wp-admin directory (don’t ask me why…).
MultiPHP INI Editor warning label:
Before editing your php.ini file I recommend making a backup before making changes.
WordPress php.ini tip of the day:
If after updating your php.ini settings within cPanel, you find your plugin or theme continues to report the wrong PHP settings, try copying the php.ini file found within your public_html directory into your /wp-admin directory, then check once again.
Well, that covers some EasyApache 4 Upgrade, PHP7 and WordPress Related Tips for cPanel web server admins and clients. If you have further questions, please feel free to contact me using the comments section below.
I’ve posted a few related article links below. If you have questions just pick up the phone and call me anytime, Jim Walker, The Hack Repair Guy, (619) 479-6637