I have seen many ways of installing newer versions of PHP on a CentOS/RHEL system. Most include replacing the distribution provided RPMs with 3rd party RPMs, replacing the entire PHP installation. I don’t like this as there is often only a few web applications that require a newer version of PHP.
I decided to build a stand-alone PHP 5.3 that will execute via CGI to run PHP scripts. This way, we can still have the distribution supplied PHP and mod_php installed with Apache, but we can override mod_php and use the newer PHP 5.3 on a per vhost basis.
The entire PHP 5.3 installation is under /opt/php53 so it will not interfere with existing PHP installations. Lets go about installing it by first installing my YUM repository.
It will depend on yum-priorities just to make sure my repository isn’t going to override any distribution provided packages. You really should already have this in place if you are installing any 3rd party repository.
Next install php53 and any php53 extensions you might want
Now finally you will need to configure Apache to use our new PHP. You will need to do this on a per vhost basis if the existing distribution PHP is installed. Otherwise it can be configure outside of a vhost.
I have only compiled the x86_64 version as that is all I have installed on my servers. I have provided the SRPM if you need to compile your own i386 version. This is fairly “beta” at the moment as I haven’t fully tested all the features and extensions of PHP. It shouldn’t break anything as the install is in its own path and does not appear in the $PATH variable but I can’t guarantee this. If you need an extension that I have not enabled, please let me know and I’ll see what I can do.