问题原文
原帖链接 · Michael Chourdakis · CC BY-SA 3.0
I 've a working production server that runs PHP 7.0, and I want to upgrade to 7.2.
I haven't found anything online that would suggest that PHP7.0 and 7.2 can co-exist. What would be the proper procedure? Just remove all php70w* packages and install all php72w ones?
This is a production server, errors must not cause it to fail.
Thanks.
已采纳解答
原帖链接 · NoAngel · CC BY-SA 3.0
This is solution for CentOS 6.x and 7.x:
yum install epel-release
then install Remi repo, for Centos 6.x:
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-6.rpm
and for Centos 7.x:
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
check which PHP packages installed:
yum list installed php*
remove current PHP:
yum remove php*
install same packages as were installed for 7.0 using PHP 7.2, for example:
yum install --enablerepo=remi-php72 php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
check version of PHP installed:
php -v
You don't need to PHP 7.0 and 7.2 coexist on Your server. If You got a problem using PHP 7.2 You can always reinstall older PHP 7.0. If not sure it will work for You on production server, try it on virtual machine first. But it worked for me on many production servers. PHP is not critical OS component, so server will never fail if PHP changed. It's just Your web app which may fail when change to 7.2, but as I wrote it's unlikely and You may reinstall older version if it happens.
I forgot about php.ini. If You want to keep Your php.ini customizations in another PHP version, make a copy of php.ini before running yum remove php*. After PHP reinstall diff saved_php.ini php.ini and look what is need to be merged.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
