How to Update EasyApache 3 to EasyApache 4

How to Update EasyApache 3 to EasyApache 4

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.

Install From CLI

  1. Connect to your server as root via an SSH connection.
  2. First, update cPanel by running the following command:
    /scripts/upcp
  3. Run the following command to initiate the migration process:
    /usr/local/cpanel/scripts/migrate_ea3_to_ea4 --run
  4. 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.
  5. 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.
  6. 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.

  1. Log into WHM as root.
  2. Type easy into the search field in the top left of WHM.
  3. Under the Software category, click on EasyApache 4.
  4. Click on the EasyApache 4 Migration button to proceed.
  5. 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.
  6. Click the Yes, run EasyApache 4 Migration button from the pop-up that displays.
  7. 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:

“Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

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.

  1. Log into WHM as root.
  2. Navigate to the MultiPHP Manager inside of WHM.
  3. Under the PHP Versions tab find the System PHP-FPM section and confirm that PHP-FPM is turned off.
  4. 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.
  5. Log into your server via SSH as root.
  6. 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
  7. Run the following command:
    cp /opt/cpanel/ea-php##/root/etc/php.ini /home/cpuser/public_html/
  8. 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
  9. 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
  10. Add the following code to the top of your website’s .htaccess file:
     suPHP_ConfigPath /home/cpuser/public_html 
  11. 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:

Caused by KeyNotFoundException in Configuration.cpp:262: Handler “application/x-httpd-ea-php56” not found End of script output before headers: phpinfo.php

Follow the instructions below to correct the suPHP configuration file.

  1. Connect to your server as root via an SSH connection.
  2. Create a backup of the suPHP configuration file by running this command:
    cp /etc/suphp.conf /etc/suphp.conf.bak
  3. Run the following command to open the suPHP configuration file:
    nano /etc/suphp.conf
  4. 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"
  5. 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"
  6. 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"
  7. 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.
  8. Finally, restart Apache, by running this command:
    /bin/systemctl restart httpd.service
  9. 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.

JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

2 thoughts on “How to Update EasyApache 3 to EasyApache 4

Was this article helpful? Join the conversation!