How to upgrade php in centos?
Centos7 Upgrade the php version to php7
1. First check if there is an old version
yum list installed | grep php
Recommended: "PHP Tutorial 》
2. If installed
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
3. After cleaning the old version, upgrade it
1. Since the yum source of Linux does not exist for php7. x, so we need to change the yum source:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2. Check whether there is php7.x in the yum source
yum search php7
See the picture below, which proves that php has been Exist in the yum source
3. yum installs php72w and various extensions, just choose what you need:
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
Installation completed
4. Check the php version
php -v
The above is the detailed content of How to upgrade php on centos. For more information, please follow other related articles on the PHP Chinese website!