FB plugin

Source Code Display Plugin

星期三, 4月 18, 2018

Upgrade PHP 5.4 to PHP 5.6 on CentOS 7


Google Cloud Engine provides different version of CentOS. One is CentOS 6x, the other is CentOS 7. Both version 6x and 7 provide the PHP 54. If you need upgrade the PHP from PHP54 to PHP56, the following steps can work for me: (My environment is CentOS 7)

Step 1: Install EPEL (Skip this if EPEL installed!)

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm



Step 2: Install the php repository setting

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm -Uvh remi-release-7*.rpm

Step 3: Enable the repository

Open the setting file!
vim /etc/yum.repo.d/remi.repo
Then, find the setting and change 'enable=0' to 'enable=1'
[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/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/php56/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

Step 4: Remove current PHP

yum remove php-common

Step 5: Install new PHP

yum install php php-gd php-mysql php-mcrypt php-mbstring
when you install successfully, try 'php -v', it should look like this:
# php -v
PHP 5.6.35 (cli) (built: Mar 29 2018 07:28:25) 
Copyright (c) 1997-2016 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

Step 6: Restart HTTP service (DON'T forget!)

service httpd restart



沒有留言:

熱門文章