How to upgrade php version in linux

1: After entering the terminal, check the PHP version. The output of
php -v
may be as follows:
PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10) Copyright © 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright © 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright © 1999-2015, by Zend Technologies
2: Execute the following command to upgrade the software repository
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel -release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3: Execute the following command to delete php
yum remove php-common
and then ask if you want to continue like installation, enter yes to
4: install php 5.6 version (php56w-devel is not required)
yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-MySQL php56w-intl php56w-mbstring
5: restart httpd
service httpd restart
View the latest version
php -v
should now be 5.6!

But note that the previously installed extensions need to be reinstalled (such as memcache, Redis extensions, etc.), php.ini and other modifications

Guess you like

Origin blog.csdn.net/qq_30566629/article/details/109316295