EasyApache (EA) is the software, included with a cPanel installation, that installs, configures, and updates server components like PHP versions and Apache modules. cPanel has recently announced the deprecation of EasyApache 3 (EA3) and that the last version of cPanel to support EA3 is version 11.62. This means that in order to upgrade to cPanel’s latest Release (as of August 22, 2017: version 11.66), you will first need to update EasyApache 3 to EasyApache 4. In this guide, you will learn how to migrate EasyApache 3 to EasyApache 4 from the Command Line (CLI) and Web Host Manager (WHM) interface.
Pre-Requisites
Read through the following warnings and notices before proceeding through the following instructions. Regardless of which method of migration you choose to utilize, this will ensure that you are fully aware of what is needed prior to updating EasyApache 3 to EasyApache 4.
Remove the PHP Switcher tool and custom PHP versions:
yum -y remove imh-php52 imh-php53 imh-php54 imh-php55 imh-php56 imh-php70 imh-php71 cpanel-phpconf
Comment out PHP Switcher tool AddHandler lines in cPanel users’ .htaccess files:
for a in $(for i in $(\ls /var/cpanel/users | grep -v system); do find /home/$i -name .htaccess; done); do sed -i /AddHandler/s/^/#/ $a; done
Disable and Backup (by renaming) cPanel users’ php.in files:
for a in $(for i in $(\ls /var/cpanel/users | grep -v system); do find /home/$i -name php.ini; done); do mv $a $a-bk; done
Comment out suphp_configpath lines in cPanel users’ .htaccess files:
for i in $(find /home/*/ -name .htaccess); do sed -i /[Ss][Uu][Pp][Hh][Pp]/s/^/#/ $i && echo $i; done
Install From CLI
- Connect to your server as root via an SSH connection.
- First, update cPanel by running the following command:
/scripts/upcp
- Run the following command to initiate the migration process:
/usr/local/cpanel/scripts/migrate_ea3_to_ea4 --run
- Review the warning that appears. This is where you can identify customizations that you may need to manually install after the migration. Typically, most of the components listed are no longer necessary or needed. Type y (for yes) and then press the Enter key to continue.
- Review the warnings related to the current configuration that cPanel identifies. This is where you can also identify customizations that you may need to manually install after the migration. Typically, most of the components listed are no longer necessary or needed. To proceed, type y (for yes) and then press the Enter key to continue.
- Review the information displayed regarding the conversion from EA3 to EA4. Again, this is where you can identify customizations that you may need to manually install after the migration. Typically, most of the components listed are no longer necessary or needed. To continue, type y (for yes) and then press the Enter key. The installation process will proceed and the CLI prompt will return when complete.
info [migrate_ea3_to_ea4] EasyApache 4 has successfully been installed.
A record of this process may be found at : /usr/local/cpanel/logs/packman/migrate_ea3_to_ea4.Tue_Oct_24_14:56:00_2017.log
root@localhost ~ $
Install from WHM
Once you have configured the Update Preferences accordingly you will be able to follow along with the steps below to migrate EA3 to EA4 from WHM.
- Log into WHM as root.
- Type easy into the search field in the top left of WHM.
- Under the Software category, click on EasyApache 4.
- Click on the EasyApache 4 Migration button to proceed.
- After the pre-flight check, review any warnings that are displayed. Then, scroll to the bottom of the page and click the Migrate button to continue.
- Click the Yes, run EasyApache 4 Migration button from the pop-up that displays.
- Once the migration completes, you will receive a successful message: “EasyApache 4 Migration has run successfully.” Click the Done button to close the Migration tool.
Advanced Troubleshooting
Converting from EasyApache 3 to EasyApache 4 may require extensive modifications after the change. Apache and PHP will be completely rebuilt throughout the process. EA 4 will attempt to match your existing profile; however, it can leave out important Apache or PHP modules. It is strongly recommended that you ensure your websites are still working normally after the migration to EA4. In the following section, we provide insight into possible issues (commonly caused by an EA3->EA4 migration) and how to resolve them.
WordPress Site Error
If you are running a WordPress site, you may receive the following error on any sites using an .htaccess file with a custom suPHP_configpath configured:
The issue is that when you use the suPHP_configpath directive, the PHP configuration from the include files located in /opt/cpanel/ea-php##/root/etc/php.d/ will not be loaded. Follow the steps below to resolve this issue.
- Log into WHM as root.
- Navigate to the MultiPHP Manager inside of WHM.
- Under the PHP Versions tab find the System PHP-FPM section and confirm that PHP-FPM is turned off.
- Scroll down to the Set PHP Version per Domain section and confirm the PHP Version for the cPanel user that owns the website displaying the error.
- Log into your server via SSH as root.
- Create a backup of your existing php.ini file by running the following command, you may adjust the path according to the actual location (the path specified in this command is the default path for a primary domain in cPanel):
cp /home/cpuser/public_html/php.ini /home/cpuser/public_html/php.ini.bak
- Run the following command:
cp /opt/cpanel/ea-php##/root/etc/php.ini /home/cpuser/public_html/
NOTE: ‘ea-php##’ should be changed to reflect the PHP version number the cPanel user is using (e.g. ‘ea-php56’ for PHP version 5.6) and ‘cpuser’ should be replaced with the cPanel username that owns the WordPress website. - Run the following loop to add missing lines to the cpuser’s php.ini:
for i in `ls /opt/cpanel/ea-php##/root/etc/php.d`; do cat /opt/cpanel/##/root/etc/php.d/$i >> /home/cpuser/public_html/php.ini; done
NOTE: ‘ea-php##’ should be changed to reflect the PHP version number the cPanel user is using (e.g. ‘ea-php56’ for PHP version 5.6) and ‘cpuser’ should be replaced with the cPanel username that owns the WordPress website. - Make a backup of your website’s .htaccess file by running the following command, you may adjust the path according to the actual location (the path specified in this command is the default path for a primary domain in cPanel):
cp /home/cpuser/public_html/.htaccess /home/cpuser/public_html/.htaccess.bak
- Add the following code to the top of your website’s .htaccess file:
suPHP_ConfigPath /home/cpuser/public_html NOTE: ‘cpuser’ should be replaced with the cPanel username that owns the WordPress website. - Reload your website and confirm the error no longer displays.
suPHP Configuration File Corruption
When switching to suPHP from CGI or DSO, EasyApache 4 does not add the necessary configuration to /etc/suphp.conf for mapping the different handler directives to their corresponding PHP binary files. You may experience a 500 Internal Server Error on PHP websites after switching to suPHP or websites forcing a download; the Apache error log will display errors like:
Follow the instructions below to correct the suPHP configuration file.
- Connect to your server as root via an SSH connection.
- Create a backup of the suPHP configuration file by running this command:
cp /etc/suphp.conf /etc/suphp.conf.bak
- Run the following command to open the suPHP configuration file:
nano /etc/suphp.conf
- Locate the following lines:
[handlers];Handler for php-scripts
application/x-httpd-php="php:/usr/bin/php" application/x-httpd-php4="php:/usr/php4/bin/php"
application/x-httpd-php5="php:/usr/bin/php" - Add the following lines below the code you found:
application/x-httpd-ea-php54="php:/opt/cpanel/ea-php54/root/usr/bin/php-cgi"
application/x-httpd-ea-php55="php:/opt/cpanel/ea-php55/root/usr/bin/php-cgi" application/x-httpd-ea-php56="php:/opt/cpanel/ea-php56/root/usr/bin/php-cgi" application/x-httpd-ea-php70="php:/opt/cpanel/ea-php70/root/usr/bin/php-cgi" application/x-httpd-ea-php71="php:/opt/cpanel/ea-php71/root/usr/bin/php-cgi" application/x-httpd-ea-php72="php:/opt/cpanel/ea-php72/root/usr/bin/php-cgi" - Remove any additional lines so that the ‘[handlers]’ section looks exactly like this:
[handlers] ;Handler for php-scripts application/x-httpd-php="php:/usr/bin/php" application/x-httpd-php4="php:/usr/php4/bin/php" application/x-httpd-php5="php:/usr/bin/php" application/x-httpd-ea-php54="php:/opt/cpanel/ea-php54/root/usr/bin/php-cgi" application/x-httpd-ea-php55="php:/opt/cpanel/ea-php55/root/usr/bin/php-cgi" application/x-httpd-ea-php56="php:/opt/cpanel/ea-php56/root/usr/bin/php-cgi" application/x-httpd-ea-php70="php:/opt/cpanel/ea-php70/root/usr/bin/php-cgi" application/x-httpd-ea-php71="php:/opt/cpanel/ea-php71/root/usr/bin/php-cgi" application/x-httpd-ea-php72="php:/opt/cpanel/ea-php72/root/usr/bin/php-cgi"
- Once you have added the necessary line(s), press Ctrl + O and then hit Enter to save your changes. Press Ctrl + X to exit nano.
- Finally, restart Apache, by running this command:
/bin/systemctl restart httpd.service
- Reload your website to confirm it is loading properly.
Persisting Errors
If you experience any persisting errors and are a customer of InMotion Hosting, please reach out to our Live Support for further assistance, or revert the EasyApache migration.
Congratulations! You are now running EasyApache 4. If you want to learn more about how to use EA4, be sure to check out our guide on installing PHP extensions using EasyApache4.
Thank you! The instructions to correct the missing handlers in suphp.conf seem to have worked perfectly.
Thanks for the feedback. We’re glad you found this helpful.