CENTOS 7 php5.4升級php7.1

環境:CentOS 7,原本已安裝 remi 的 PHP 5.4.37,要升級為PHP 7
察看php版本
$ php -v
PHP 5.4.16 (cli) (built: Jan 21 2015 11:35:44)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

安裝含 PHP7 的 remi repo
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

查所有repo,可發現已經有相關的 repo

$ yum repolist all
repo id      repo name                                                        status
.....
!remi        Remi's RPM repository for Enterprise Linux 7 - x86_64            disabled
.....
remi-php71   Remi's PHP 7.1 RPM repository for Enterprise Linux 7 - x86_64    disabled
.....

後面會用到 yum-config-manager,若無此指令,可先用 yum search 查詢在那個套件再安裝

$ yum search yum-config-manager
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.yzu.edu.tw
 * epel: mirror01.idc.hinet.net
 * extras: ftp.yzu.edu.tw
 * remi-safe: mirror.innosol.asia
 * updates: ftp.yzu.edu.tw
=================================== Matched: yum-config-manager ===================================
remi-release.noarch : YUM configuration for remi repository
yum-utils.noarch : Utilities based around the yum package manager
$ yum install yum-utils

開啟 remi、remi-php71

$ yum-config-manager --enable remi
$ yum-config-manager --enable remi-php71

升級所有相關的php套件 (若是初次安裝,可只執行 yum install php,再依需要安裝其他套件)

$ yum update php*

[安裝 php-pecl-memcached] 
$ yum install php-pecl-memcached

安裝 pecl-zip] 
$ yum install php-pecl-zip

[性能相關] 
安裝 OPcache、開啟 Opcache file cache 
$ yum install php-opcache

編輯 OPcache 設定檔 
$ vi /etc/php.d/10-opcache.ini
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.huge_code_pages=1
opcache.file_cache=/home/opcache

建立 Opcache file cache 資料夾 
$ mkdir /home/opcache






留言

這個網誌中的熱門文章

java 數字轉字串 字串轉數字

MS sqlServer資料庫移轉至MySQL-->利用MySQL WorkBench

sql server 15023 error [SQL SERVER問題: 使用者、組或角色 '*****' 在當前資料庫中已存在]