302: Upgrade PHP using EasyApache
In this article we'll discuss how you can upgrade your server's version of PHP using the EasyApache script in WHM (Web Host Manager). If you happen to have read our previous article on how to upgrade Apache using EasyApache you'll notice we skipped over the PHP menu, in this article we'll go more in-depth into the available PHP settings you can set within EasyApache.
If you came here from our article on how to pass PCI compliance scans, outdated versions of PHP are a common thing that can cause your website to fail a PCI scan. So understanding how to update PHP on your own using EasyApache in WHM is great knowledge to have in order to help keep your website PCI compliant.
This process would require having root access on your VPS or dedicated server, most users would never need to change this on their own, but the option is available for advanced users.
- Log into WHM.
- In the Find box at the top-left, type in Easy, then click on EasyApache.
- Leave the Previously Saved Config (** DEFAULT **) option selected, and click on Start customizing based on profile.
- In most cases you'll be keeping the same version of Apache, so simply click Next Step on the Apache Version page.
- In this example we have PHP 5.2.17 installed already, so you'll want to click on PHP 5.3.18, and then click on Next Step.
- On the Short Options List page you can set what options PHP will be compiled with. In this guide we are just talking about upgrading PHP, so you can simply scroll to the bottom of the page and click on Save and Build.
- A Confirm Action window will pop-up asking if you'd like to Recompile Apache and PHP now? go ahead and click Yes.
- Next a Please ackowledge window will pop-up letting you know if the Apache build process is interrupted (you close your web-browser for instance), this could result in data loss. An Apache rebuild in some cases can take upwards of 45 minutes, so it's important to make sure that you'll have access to WHM for the entire duration. Once you understand these implications then click on I Understand.
- You should briefly see a build page that lists any errors if they were encountered, then after about 5 seconds it should automatically start the rebuild process and show you the status screen of this happening. The Apache rebuild can take upwards of 45 minutes so please be patient and be sure not to close your web-browser during the process.
- After Apache and PHP are compiled a Configure Suexec and PHP window will pop-up, in this case we are simply going to leave the current configuration with our Default PHP Version (.php files) being set to 5, the PHP 5 Handler being set to suphp, and Apache suEXEC being set to on. So you can simply click on Close.
- PHP should now be upgraded on your server, the easiest way to confirm this update is by creating a phpinfo(); info page to see PHP settings.
- When you view your phpinfo(); page you should now notice the PHP version is stating 5.3.18 which is what we selected to upgrade to, and your build date should reflect today's date.
You should now understand how to upgrade your PHP version on your server utilizing EasyApache within WHM.
Thank you for your feedback!