Monday, 8 January 2018

How to Upgrade PHP version to 7.0 in CentOS 6/7

Add yum repository information

Before installing, you need to add the yum repository information for the corresponding CentOS version using the rpm command.
CentOS 6.x:
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
CentOS 7.x:
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Upgrade PHP

Now you can install PHP 7.0’s mod_php SAPI (along with an opcode cache) by running the following command in the terminal
# yum install php70w php70w-opcache
Important note
If we would like to upgrade php to this version it is recommended that you first check whether your system will support the upgrade. For example you can validate this, if any CPanel like software runs fine after the upgrade. Unless you know what you are doing it is risky to upgrade an existing system.
If you are confident that the upgrade will support the system, then proceed to upgrade PHP using the following commands,
# yum install yum-plugin-replace
# yum replace php-common --replace-with=php70w-common

Verify the upgrade

Once the upgrade process is finished, you can verify the installation by running the following command in your terminal,
# php -version
If the php has been upgraded successfully, you will receive the following output,
PHP 7.0.15 (cli) (built: Jan 19 2017 21:55:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

No comments:

Step-by-step OpenLDAP Installation and Configuration on server

This tutorial describes how to install and configure an OpenLDAP server and also an OpenLDAP client. Step by Step Installation and Conf...