Contents[Show]

1. Intro

Steps to upgrade from php v5.3.3 (CentOS 6.10 default) to php v7.1.

 

2. Why upgrade?

Because of http://php.net/supported-versions.php.

We'll use the Webtatic repo for this. Webtatic seems to be the most practical and stable to use for this purpuse. They also have the clearest and to the point howto-guides on the interweb!

 

3. The Procedure

If php v5.3 is already installed, follow these steps.

# yum install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
#
yum install yum-plugin-replace
# # yum replace php-common --replace-with=php71w-common

Now what happens is that the yum-replace plugin will check what php modules are already installed and simply replace them with php 7.1.

 

If php wasn't already installed, use these steps instead.

# yum install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum install php71w-common

Install other modules as necessary. Php-common is however the base install.

For both alternatives, after install and-or upgrade check and edit /etc/php.ini for any custom changes you may have made before upgrading or installing.

Common changes includes eg

post_max_size
upload_max_filesize

 

4. Sources

https://webtatic.com/packages/php71/

http://phpversions.info/operating-systems/