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).
Below we cover how to:
Ensure cPanel is Updated
Before continuing to install PHP versions:
- 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.
- Ensure EasyApache4 is installed by searching for it on the left side of WHM. If not, or you have EasyApache3 instead, install EasyApache4.
- Create a server snapshot in your Account Management Panel (AMP).
Install PHP Versions with EasyApache4
- Log into WHM as root.
- On the left, search for and select EasyApache4.
- At the top, select Customize to edit your current server configuration.
- On the left, select PHP Versions.
- 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).
- 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.
- Review the pending changes. Once you’re sure of the changes you want to make, select Provision at the bottom.
- 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 harden managed VPS Hosting. Or learn more about managing cPanel accounts in our Managed VPS Hosting Product Guide.