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 (eXtensible Stylesheet Language Transformation)
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
>








25th June 2006, 04:41
thanks for the info…. I totally new to cpanel and I was afraid I would break just like plesk when doing upgrades….
everything went well …
lets hope they move to apache 2.x soon
14th August 2006, 05:25
hey it does not work for me. I keep getting php 4.4.3 installed over and over. is it something to do with the buildapache.sea that the script gets? or is it cpanel version?
14th August 2006, 06:25
ashish,
This should work no matter what… Of course you might have a broken setup that might prevent things from working properly. In this case I would suggest to talk with a sysadmin to have this done for you or open a ticket with your hosting company to do it for you. There is no way for me to see what problem you have without access to the system and without knowing the OS version/release, CPanel version, etc.
21st November 2006, 10:23
exactly the same thing…want to upgrade to 4.4.4 but it just wont upgrade. from verbose log i can see that it does something with the apache but no sign of php.
31st January 2007, 11:38
Hello,
I have a problem doing that.
After rebuild Apache, in httpd.conf I see comments in mod_php4 and mod_php5 modules and the directives
31st January 2007, 11:41
Hello,
I have a problem doing that.
After rebuild Apache, in httpd.conf I see comments in mod_php4 and mod_php5 modules and the directives IfModule mod_php5 os mod_php4 dont work.
Whats is the problems?
PHP5 don’t compile as a module?
Thanks
18th July 2007, 16:08
I’m trying to add a simple –enable-soap and I honestly can’t… searched the whole ‘net… can you help me?
18th July 2007, 20:32
Hey Bruno,
You should be able to create a file
/var/cpanel/easy/apache/rawopts/all_php5 or all_php4 whatever is the case with the content:
–enable-soap
Then recompile php with easyapache.
For more details check the cpanel docs:
http://www.cpanel.net/support/docs/easyapache.htm
I hope this will help you,
- Marius -
19th July 2007, 21:42
Didn’t help… still didn’t work… I tried using –enable-soap and soap=enable on the file… nothing…
20th July 2007, 06:43
Are you typing -enable-soap or –enable-soap? There should be two hypens before enable
20th July 2007, 06:54
There is something in my wordpress installation (not sure what) that is stripping the second “-” and this is why it appears like that. Sorry about that. M.
13th September 2008, 12:25
[...] Upgrading PHP Read More [...]
13th September 2008, 12:43
[...] to PHP5 just use the regular buildapache method. For more details you can see my previous post: “Upgrade php on CPanel/WHM”. Read [...]