Home  >  Article  >  Operation and Maintenance  >  How to solve centos upgrade php version

How to solve centos upgrade php version

WJ
WJOriginal
2020-06-05 15:44:125394browse

How to solve centos upgrade php version

How to solve centos upgrade php version?

Since the php version 5.4 installed by default yum on Linux Centos 7 has some loopholes, it is necessary to upgrade the php version to version 7.2

1. Check the currently installed PHP

View the current PHP version

    php -v

View the current PHP-related installation packages

  yum list installed | grep php

2. Change the RPM source

#Centos 5.X:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
#CentOs 6.x:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
#CentOs 7.X:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3. Stop related services

Close php-fpm and nginx Service

service php-fpm stop
/usr/local/nginx/sbin/nginx -s stop
BashCopy

4. Delete Already installed PHP related packages

  yum remove php*

5. Install the new version of PHP

php 7.0/7.1/7.2 respectively represented as 70w/71w/72w

Currently (2018-5-4)

The highest RPM source for CentOs 6.x is only 7.1

The highest RPM source for CentOs 7.x is 7.2

yum install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml php71w-ldap php71w-mcrypt

6. Restart related services (can be omitted)

service php-fpm start
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

7. Check the version again

   php -v

Related references:centOS tutorial



The above is the detailed content of How to solve centos upgrade php version. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn