Upgrade PHP on CentOS (CentOS version 6 or 7)

You may find that you need to upgrade PHP on your CentOS install in order to meet dependencies for an application. For example, a WordPress plugin:

CentOS by nature maintains the same package version throughout the life cycle of its release, so for CentOS 7 you end up with PHP version 5.4 (e.g., 5.4.17).

The good news is that you can upgrade PHP using the IUS Community project repositories without breaking your CentOS install.

Here are the steps, which need to be run with sudo permissions:

With the last step you may receive the following warning:

For this procedure the warning is typical, so hit Yes

You will then be presented with a transaction summary as follows:

Verify that all of the packages being removed are being replaced with equivalent packages of the newer version. Then hit Yes.

Once complete, restart all services that use PHP or reboot the server.  Typically this is Apache, so to restart it issue the following command: