Upgrade PHP to version 7.0
Step1: How to configure latest Remi repository in CentOS/Fedora/RHEL
Firstly, we need to add the correct Remi repository and enable Remi update, remi release and remi-php70 repository: Go to /etc/yum.repos.d/ directory and download the latest remi repo file:
[root@ssdvps~]# wget http://rpms.famillecollet.com/enterprise/remi.repo
By default, other Remi repository would be disabled. If you want to enable it permanently, open the file vi /etc/yum.repos.d/remi.repo and change the value of enabled from 0 to 1.
Step 2: Install/Upgrade PHP to version 7.0
Firstly remove the older php installation using yum remove command as shown below:
[root@ssdvps ~]# yum remove php php-cgi php-cli php-common
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-49.el6 will be erased
---> Package php-cli.x86_64 0:5.3.3-49.el6 will be erased
---> Package php-common.x86_64 0:5.3.3-49.el6 will be erased
--> Processing Dependency: php-common(x86-64) = 5.3.3-49.el6 for package: php-pdo-5.3.3-49.el6.x86_64
--> Processing Dependency: php-common(x86-64) = 5.3.3-49.el6 for package: php-mysql-5.3.3-49.el6.x86_64
--> Running transaction check
---> Package php-mysql.x86_64 0:5.3.3-49.el6 will be erased
---> Package php-pdo.x86_64 0:5.3.3-49.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================
Package Arch Version Repository Size
=====================================================================================
Removing:
php x86_64 5.3.3-49.el6 @base 3.5 M
php-cli x86_64 5.3.3-49.el6 @base 6.2 M
php-common x86_64 5.3.3-49.el6 @base 2.9 M
Removing for dependencies:
php-mysql x86_64 5.3.3-49.el6 @base 216 k
php-pdo x86_64 5.3.3-49.el6 @base 168 k
Transaction Summary
=====================================================================================
Remove 5 Package(s)
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Erasing : php-mysql-5.3.3-49.el6.x86_64 1/5
Erasing : php-5.3.3-49.el6.x86_64 2/5
Erasing : php-cli-5.3.3-49.el6.x86_64 3/5
Erasing : php-pdo-5.3.3-49.el6.x86_64 4/5
Erasing : php-common-5.3.3-49.el6.x86_64 5/5
Verifying : php-5.3.3-49.el6.x86_64 1/5
Verifying : php-pdo-5.3.3-49.el6.x86_64 2/5
Verifying : php-mysql-5.3.3-49.el6.x86_64 3/5
Verifying : php-cli-5.3.3-49.el6.x86_64 4/5
Verifying : php-common-5.3.3-49.el6.x86_64 5/5
Removed:
php.x86_64 0:5.3.3-49.el6 php-cli.x86_64 0:5.3.3-49.el6
php-common.x86_64 0:5.3.3-49.el6
Dependency Removed:
php-mysql.x86_64 0:5.3.3-49.el6 php-pdo.x86_64 0:5.3.3-49.el6
Complete!
Stop the Apache2 service
[root@ssdvps ~]# service httpd stop
Stopping httpd: [ OK ]
Now install PHP 7.0 using remi-php70 repo:
[root@ssdvps ~]# yum --enablerepo=remi-php70 install php
Sample output:
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.clouvider.net
* epel: mirror.freethought-internet.co.uk
* extras: mirrors.clouvider.net
* remi: fr.mirror.babylon.network
* remi-php70: fr.mirror.babylon.network
* remi-safe: fr.mirror.babylon.network
* updates: mirrors.clouvider.net
remi | 2.9 kB 00:00
remi/primary_db | 1.8 MB 00:00
remi-php70 | 2.9 kB 00:00
remi-php70/primary_db | 166 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.0.21-1.el6.remi will be installed
--> Processing Dependency: php-common(x86-64) = 7.0.21-1.el6.remi for package: php-7.0.21-1.el6.remi.x86_64
--> Processing Dependency: php-cli(x86-64) = 7.0.21-1.el6.remi for package: php-7.0.21-1.el6.remi.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:7.0.21-1.el6.remi will be installed
---> Package php-common.x86_64 0:7.0.21-1.el6.remi will be installed
--> Processing Dependency: php-json(x86-64) = 7.0.21-1.el6.remi for package: php-common-7.0.21-1.el6.remi.x86_64
--> Running transaction check
---> Package php-json.x86_64 0:7.0.21-1.el6.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================
Package Arch Version Repository Size
=====================================================================================
Installing:
php x86_64 7.0.21-1.el6.remi remi-php70 2.7 M
Installing for dependencies:
php-cli x86_64 7.0.21-1.el6.remi remi-php70 4.0 M
php-common x86_64 7.0.21-1.el6.remi remi-php70 988 k
php-json x86_64 7.0.21-1.el6.remi remi-php70 54 k
Transaction Summary
=====================================================================================
Install 4 Package(s)
Total download size: 7.7 M
Installed size: 28 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): php-7.0.21-1.el6.remi.x86_64.rpm | 2.7 MB 00:00
(2/4): php-cli-7.0.21-1.el6.remi.x86_64.rpm | 4.0 MB 00:00
(3/4): php-common-7.0.21-1.el6.remi.x86_64.rpm | 988 kB 00:00
(4/4): php-json-7.0.21-1.el6.remi.x86_64.rpm | 54 kB 00:00
-------------------------------------------------------------------------------------
Total 6.9 MB/s | 7.7 MB 00:01
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
Userid : Remi Collet <RPMS@FamilleCollet.com>
Package: remi-release-6.9-1.el6.remi.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-json-7.0.21-1.el6.remi.x86_64 1/4
Installing : php-common-7.0.21-1.el6.remi.x86_64 2/4
Installing : php-cli-7.0.21-1.el6.remi.x86_64 3/4
Installing : php-7.0.21-1.el6.remi.x86_64 4/4
Verifying : php-7.0.21-1.el6.remi.x86_64 1/4
Verifying : php-common-7.0.21-1.el6.remi.x86_64 2/4
Verifying : php-cli-7.0.21-1.el6.remi.x86_64 3/4
Verifying : php-json-7.0.21-1.el6.remi.x86_64 4/4
Installed:
php.x86_64 0:7.0.21-1.el6.remi
Dependency Installed:
php-cli.x86_64 0:7.0.21-1.el6.remi php-common.x86_64 0:7.0.21-1.el6.remi
php-json.x86_64 0:7.0.21-1.el6.remi
Complete!
Step3: Verify PHP Version
Verify the latest installed php version using below command:
[root@ssdvps ~]# php -v
PHP 7.0.21 (cli) (built: Jul 5 2017 14:45:27) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
Start the Apache Server:
[root@ssdvps ~]# service httpd start
Starting httpd: [ OK ]
Comments
Post a Comment