How To Update Apache And PHP In A cPanel Server?
Every once in a while system administrators needs to install and/or update and/or modify Apache, PHP, Tomcat and other web server components in the server. cPanel.com provides their own custom script or program (EasyApache) to do this extremely easily with an interactive interface.
You may also do this via WHM >> Software >> EasyApache (Apache Update) option but it is recommended to do this via command line.
To run easyapache, you just need to login (SSH) to the server as root and execute the following command (/scripts/easyapache).
This loads the easyapache menu.
select Customize Profile option with ‘TAB’ key and hit Enter key.
Select the Apache version that you want to install from the list by pressing spacebar key and go to ‘Next Step’ as said earlier. This will load the list of available PHP versions.
Select the PHP version and go to Next Step. You can see some of the versions with *END OF LIFE* status. These PHP versions are not recommended. This brings up the list of modules and extensions.
Select the required modules using ‘Spacebar’ key and go to ‘Save and Build’ option with ‘TAB’ key, hit ‘Enter’. If you need Apache Tomcat installed in the server, you just need to enable Tomcat from this list.
You may choose ‘Exhaustive Options List‘ if you need a detailed list of available Apache and PHP modules and extensions. Press the ‘Down Arrow’ key to go to the next page of available modules. After selecting all the modules you want go to Next Step.
Click on Save and build option to recompile Apache and PHP with the new versions and the set of modules/extensions.
Save only (Do Not build) option is to just save these selections in a profile which you can use to rebuild the server when required.
Once you select the ‘Save and Build’ option, easyapache runs the recompilation process and will install and/or modify Apache and PHP configuration. Apache service will be restarted after the build. So for that point of time, websites will go down. But most often it takes only a matter of few seconds.
Sometimes Easyapache might error out due to dependancy errors or any other errors, then you need to check the easy apache verbose log file which is usually something like /usr/local/cpanel/logs/easy/apache/build.xxxxxxx. It will be shown in the begining of the build process. But don’t worry, easyapache will load the previously saved configuration if the rebuild is not completed successfully.