centos 7 upgrade php 5.4 to 5.6.40
7 年 ago jony centos 7 upgrade php 5.4 to 5.6.40已关闭评论
1. Verify current version of PHP
Type in the following to see the current PHP version:
| 1 | php -v |
The output should match this:
| 123 | PHP 5.4.16 (cli) (built: Apr 12 2018 19:02:01)Copyright (c) 1997-2013 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies |
Perfect, let’s continue!
2. Install the REMI and EPEL repositories
If you don’t already have them, install the Remi and EPEL repositories:
| 12 | rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm |
Enable the Remi repository globally:
| 1 | nano /etc/yum.repos.d/remi.repo |
Under the section that looks like [remi] make the following changes:
| 12345678 | [remi]name=Remi's RPM repository for Enterprise Linux 7 - $basearch#baseurl=http://rpms.remirepo.net/enterprise/7/remi/$basearch/#mirrorlist=https://rpms.remirepo.net/enterprise/7/remi/httpsmirrormirrorlist=http://cdn.remirepo.net/enterprise/7/remi/mirrorenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi |
Also, under the section that looks like [remi-php55] make the following changes:
| 123456789 | [remi-php56]name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch#baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/#mirrorlist=https://rpms.remirepo.net/enterprise/7/php56/httpsmirrormirrorlist=http://cdn.remirepo.net/enterprise/7/php56/mirror# NOTICE: common dependencies are in "remi-safe"enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi |
Type CTRL-O to save and CTRL-X to close the editor
3. Upgrade PHP 5.4 to PHP 5.6
Now we can upgrade PHP. Just type in the following command:
| 1 | yum -y upgrade php* |
Once the upgrade has completed, verify that you have PHP 5.6 installed:
| 1 | php -v |
Output should look like:
| 123 | PHP 5.6.38 (cli) (built: Oct 24 2018 12:50:38)Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies |
Sweet deal, upgrade is done!!