Upgrade PHP on CPanel/WHM

The default PHP installation in CPanel might not be enough for all of us. We might need to add some php modules or just to upgrade to a new PHP version. On a CPanel server the best way to do this is from inside CPanel itself. If possible, we would not want to mess with the CPanel installation and do something manual that might break CPanel.

This is something very simple… In fact with a few clicks this is completed. Go to your regular WHM - WebHost Manager - interface (not CPanel), that looks like https://server_IP_or_hostname:2087/ On the “Software” tab click on the link “Apache Update”. You are presented with a page that allows you to change the various php modules that you can include/exclude from the installation. You will always be presented here with the default CPanel config. In case you have previously done this you can retrieve your old selection by clicking on “Load previous config”. Here are the default options enabled by default in the current CPanel versions:

Php Module
Version 4.4.2
Bc Math
Calendar Support
FTP
Magic Quotes
Mysql Module
Discard Path
Pear
Sockets
Track Vars
Zlib

Until recently ‘Versioning’ was also ON by default, but after the latest incompatibilities this has been disabled from default options. This is known to cause problems with eaccelerator so you might want to leave it off in case you are using eaccelerator. All the available PHP options (with the default ones in bold) are:

Version 4.3.11
Version 4.4.1
Version 4.4.2
Version 5.0.4
Version 5.0.5
Version 5.1.2
Version 5.1.4
Bc Math
Calendar Support
Curl (Version 7.15.3)
Curl SSL Support (Version 2.8.27)
Dom XSLT
Exif
Flash
Ftp
GD (Version 2.0.15)
GetText
Iconv (experimental)
Imap Module (Version 2004g)
Java (must already be installed, or install will fail)
Mb String
Mcrypt (Version 2.5.7)
Memory Limit (experimental)
Mhash (Version 0.8.18)
Ming Support (Not Recommended due to various problems) (Version 0.3beta1)
Magic Quotes
MM Session Module (Version 1.3.1)
Mysql Module
SNMP
Openssl Support
Discard Path
PDFlib (requires license for commerical use; see www.pdflib.com/pdffiles/PDFlib-Lite-license.pdf)
Pear
Postgresql (will break 7.2.x or earlier, please make sure you have 7.3.x or later installed)
Pspell Module
Sablot XSLT [may cause problems with chili!asp]
SafeMode
Sockets
Use System Mysql
Track Vars
Freetype Support
Versioning
WDDX
XML RPC
Zip
Zlib
  • PHP version - choose the most recent available PHP4 or PHP5 version (based on your applications needs). If possible try to migrate to PHP5 as this would be a good idea. If you can’t… try to update your applications to work on PHP5, and only then upgrade. In this case you would want to use the latest PHP4 version.

  • PHP modules - I will always recommend including only the modules that are needed and leave all the others off. If you will need to add a new module, you can always return and recompile php again as this is very simple.

Once you are satisfied with your selection click on “Start Build” and take a break. Depending from the options you have chosen and the speed of the server this will take a few minutes. CPanel will re/compile all the needed libraries and php module itself based on your selection.

Hopefully in the end you will see the successful result “Build Complete” (check the screen for any errors from compile). If there is something wrong with your build you can always go back and remove the offending module or selection and recompile again. Check with **phpinfo **(or from the console with “php -m”) that you have completed this successfully and all the modules you intended to include are present in the new running PHP.

Note: There is also a console application that you can use to get the same result: /scripts/easyapache

comments powered by Disqus