I found some blog posts about this, but it's rather lack of descriptions on possible side effects.

I could really use some detailed on these steps:

How to add a repo that provides PHP 5.4 into yum

Can this seamlessly replaces the current PHP version in CentOS?

How can I switch back to the official repo when it supports PHP 5.4? (current 5.3.3 in my system)

Will there be any potential to break PHP modules I currently using?

Note

People successfully upgraded with the same method on newer versions, and suggest removing specific versions in the question. While it is good to pin down versions in case newer versions actually breaks something, I'd like keep the latest succeed version suggested by the community as a note.

Feel free to update this if you have successfully upgraded on other versions.

3 Answers
3

I followed the instructions from Install Apache/PHP 5.4.10 on Fedora 17/16, CentOS/RHEL 6.3/5.8 with a slight modification. It took maybe 10min. My exact commands are shown below. Note that the first command had to be changed from what is shown in the article. The change was from epel-release-6-7.noarch.rpm to epel-release-6-8.noarch.rpm.

Things often get ugly with remi. I prefer to use iuscommunity repository for up-to-date php. Another way is to use Zend server repo, but it seems a bit overhead for me.
–
Kazimieras AliulisDec 28 '12 at 12:40

2 . You need to first see what existing installed packages need replacing, you can do this by using yum shell to combine removing php-common and installing php54w-common in one transaction (so shared dependencies aren't removed)

If there are other packages than php* in this list then you can't seamlessly switch to Webtatic PHP 5.4, but will have to investigate alternatives. Webtatic has replacement packages for all base php packages (see the packages listed on the page linked to in 1. for confirmation), so there should be no issues, unless you use other 3rd party repositories that have packages installed dependent on the specific php version installed.

For the rest of the installation (still in yum shell), you just remove these packages and install their php54w-* counterparts:

You should then only see the packages you've set to be removed and installed in the list, and you can confirm the installation to switch over. Any services currently running with php loaded will need to be restarted, for instance httpd or php-fpm.

As for this being 'seamless', any software changes happening while users are able to access the website should have the consequences fully understood. Shared libraries being removed and added when a process hasn't already loaded them could potentially load while the shared library isn't there. It's better to do software upgrades like this offline, and preferably tested on a non-production machine first to verify the process works as expected.

3 . To switch to a hypothetical CentOS base php54 package (CentOS 5 used php53 prefix), you just run the above steps replacing php removal with php54w removal, and php54w installation with php54 installation e.g.

However as for the switch to the hypothetical base php54, there will likely be no alternatives for some packages (e.g. there was no php53-pecl-memcache extension in CentOS 5) and Webtatic has packages that aren't available in CentOS base (e.g. php54w-pecl-zendopcache). If they are missing, then you usually don't have any other option than to use pecl directly to install them.

4 . Any PHP upgrade may introduce bugs, and websites should be retested. This is not specific to Webtatic, but the general idea that new features introduce new bugs.

Unlike Remi's repository in the accepted answer, the Webtatic EL6 repository never uses the same package names as CentOS base repositories, so will not override installation/upgrade of packages you don't intend to switch to, and as such is enabled by default.