Centos upgrade php (IUS Community)

最後更新: 2019-12-17

介紹

 

IUS Community (Inline with Upstream Stable):

HomePage: https://ius.io/

The IUS Community Project is aimed at providing up to date and regularly maintained RPM packages

for the latest upstream versions of PHP, Python, MySQL

http://dl.iuscommunity.org/pub/ius/stable/Redhat/version/arch/

 

 


Install the IUS and EPEL repository

 

Centos 7:

yum install -y epel-release

wget https://repo.ius.io/ius-release-el7.rpm

rpm -Uvh ius-release-el7.rpm

Centos 6:

EPEL

* epel-release is needed by ius-release-*.ius.el6.noarch.rpm

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/i386/epel-release-5-4...

rpm -Uhv epel-release-6-4.noarch.rpm

wget https://repo.ius.io/ius-release-el6.rpm

rpm -Uvh ius-release-*

rm -f ius-release-*

有用工具:

yum install yum-plugin-replace

 


Old OS

 

Centos 5

Cemtps 5 Default 只有以下 version 的 php:

base:

php.i386                                 5.1.6-24.el5_4.5

epel:

php53.x86_64

# ius-release-xxxx.ius.el5.noarch.rpm

# i386

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-xxxx...

# x86_64

wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-xx...

rpm -Uhv ius-release-xxxx.ius.el5.noarch.rpm

yum install yum-plugin-replace

 


升級 php

 

查看現在安裝了的 Package:

rpm -qa | grep php

php-pear-db-1.7.13-2.el5.rf
php-mysql-5.1.6-24.el5_4.5
php-xmlrpc-5.1.6-24.el5_4.5
phpmyadmin-2.11.10-2.el5.rf
php-pear-1.4.9-6.el5
php-common-5.1.6-24.el5_4.5
php-5.1.6-24.el5_4.5
php-xml-5.1.6-24.el5_4.5
php-pecl-Fileinfo-1.0.4-3.el5.centos
php-cli-5.1.6-24.el5_4.5
php-devel-5.1.6-24.el5_4.5
php-mcrypt-5.1.6-15.el5.centos.1
php-mbstring-5.1.6-24.el5_4.5
php-pdo-5.1.6-24.el5_4.5
php-gd-5.1.6-24.el5_4.5

 

查看 ius 的 package:

yum list | grep -w \.ius\.

...............
php53u.i386                              5.3.28-1.ius.el5              ius
php53u-bcmath.i386                       5.3.28-1.ius.el5              ius
php53u-cli.i386                          5.3.28-1.ius.el5              ius
php53u-common.i386                       5.3.28-1.ius.el5              ius
php53u-dba.i386                          5.3.28-1.ius.el5              ius
php53u-debuginfo.i386                    5.3.28-1.ius.el5              ius
php53u-devel.i386                        5.3.28-1.ius.el5              ius
...............

升級:

yum replace php --replace-with php53u

OR

yum replace php --replace-with php54

yum replace php --replace-with php56u

 

其他常見的 modules:

  • php53u-gd
  • php53u-imap
  • php53u-mbstring
  • php53u-mcrypt
  • php53u-mysql
  • php53u-pear
  • php53u-soap
  • php53u-tidy
  • php53u-xcache
  • php53u-xml
  • php53u-pdo
  • php53u-dba
  • php53u-suhosin

PHP 的 DBA(Database (dbm-style) Abstraction Layer)
PDO(PHP Data Object)

Output:

WARNING: Unable to resolve all providers: ['config(php-common)', 'dbase.so()(64bit)', 
                                          'php-dbase', 'php-mime_magic', 'php-pcntl']
This may be normal depending on the package.  Continue? [y/N] y

Downgrading from IUS Packages to Stock RHEL Packages

還原:

yum replace php53 --replace-with php

 

Creative Commons license icon Creative Commons license icon