How to Install PHP Versions in EasyApache 4

PHP 7.2 reached end of life (EOL) in January 2021 and PHP 8 is available now. The major changes of this new PHP version affect many of the most popular PHP-based content management systems (CMSs) and overall LAMP-stack server security as features have been heavily revised for better security and performance. It’s important to know how to maintain up-to-date PHP versions on your cPanel VPS or dedicated server with WebHost Manager (WHM).

For a seamless transition and optimized performance, consider upgrading your PHP hosting to PHP 8 hosting.

Below we cover how to:

Ensure cPanel is Updated

Before continuing to install PHP versions:

  1. Ensure cPanel is up to date. You can update cPanel via SSH or log into WHM as root to check for an update notification in the upper-right corner.
  2. Ensure EasyApache4 is installed by searching for it on the left side of WHM. If not, or you have EasyApache3 instead, install EasyApache4.
  3. Create a server snapshot in your Account Management Panel (AMP).

Install PHP Versions with EasyApache4

Install PHP Versions with toggle buttons
Click to enlarge this screenshot image.
  1. Log into WHM as root.
  2. On the left, search for and select EasyApache4.
  3. At the top, select Customize to edit your current server configuration.
  4. On the left, select PHP Versions.
  5. Uninstalled PHP versions will have a gray slider on the right side. Installed PHP versions will have a blue slider. To install a new PHP version, select the slider for the new PHP version(s) you want to install so it turns blue.

    You should uninstall old PHP versions that have reached end-of-life (PHP 7.3 and older as of January 2021). However, before doing so, you must ensure the older PHP versions aren’t currently used by any web applications on your server before removing them. If you’re unsure about this, install the newest PHP version first. Then test all websites and applications in your server environment to ensure there are no compatibility issues. Afterwards, remove the older PHP version(s).

  6. Select Next to make further changes within EA4 until you reach the Review section. If you don’t need to make any other changes besides install PHP versions, simply select Review on the left.
  7. Review the pending changes. Once you’re sure of the changes you want to make, select Provision at the bottom.
  8. Select Done.

Congratulations, now you know how to install PHP versions using EasyApache 4. Check out our guide if you are seeing the Fatal Error: Class ‘PDO’ Not Found message on your site after updgrading.

Looking for ways to ensure your cPanel VPS or Dedicated Server is secure? Check out our guide on how to maintain a secure VPS, or learn more about managing cPanel accounts in our Managed VPS Hosting Product Guide.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

4 thoughts on “How to Install PHP Versions in EasyApache 4

  1. As of 3/24/22 the section of this document that outlines the steps for Installing PHP Versions using EasyApache4 needs to be updated. Apparently the software has changed.

    1. Thank you for contacting us and letting us know. We will review and make any necessary updates as soon as possible.

    1. Hello! In almost all situations (including this one), WHM will automatically reboot the server during the installation process if it is required. Hope that helps!

Was this article helpful? Join the conversation!