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

How to solve centos upgrade php version

WJ
Release: 2020-06-05 15:44:12
Original
5473 people have browsed it

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
Copy after login

View the current PHP-related installation packages

  yum list installed | grep php
Copy after login

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
Copy after login

3. Stop related services

Close php-fpm and nginx Service

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

4. Delete Already installed PHP related packages

  yum remove php*
Copy after login

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
Copy after login

6. Restart related services (can be omitted)

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

7. Check the version again

   php -v
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template