In servers without any control panel you might have installed Apache/PHP modules after downloading the source files. However, in cPanel servers, you can upgrade/downgrade Apache/PHP or add/remove it’s modules using EasyApache via WHM or using script via back-end (shell).
Before recompiling Apache/PHP
You should take precautions before proceeding with the recompilation. Make sure you do the following before initiating the recompilation.
1. Take a backup of apache and php configuration files.
mkdir /root/back cp -a /usr/local/apache/conf /root/back cp -a /usr/local/lib/php.ini /root/back
2. Keep a list if the Apache and php modules enabled in the server.
touch /root/back/modules_list php -v >> /root/back/modules_list php -m >> /root/back/modules_list httpd -v >> /root/back/modules_list httpd -M >> /root/back/modules_list
3. If you plan to upgrade the PHP on the server, make sure that the scripts present in the server are compatible with the new version. Some functions may be deprecated in the new version. For example, if you upgrade PHP to the version 5.3 [these INI directives/features/functions are deprecated http://php.net/manual/en/migration53.deprecated.php ]
Via WHM interface
1. Login to WHM (http://ipaddress:2086/) using the root login credentials.
2. Select Software >> EasyApache (Apache Update).
3. Select start customizing based on a profile.
4. Select Apache version.
5. Select PHP version.
6. Select Exhaustive Options List
7. Tick/un-tick appropriate modules and press ‘Save and Build’.
8. Save and Build !!
Via back-end (shell)
1. Login to the server as root.
ssh root@ipaddress -pport
2. Run the script easyapache
3. Now select appropriate versions and modules as mentioned before.
1. Check the versions of apache and PHP.
2. Crosscheck whether the modules are enabled.
3. Check whether the sites are loading fine.
The files related to EasyApache are located in the following directories.
If you do not see the module you need in the easyapache, you can add custom modules to easy apache. Follow the steps mentioned here.
You can read about saving custom options in EasyApache, from here.