Home  >  Article  >  Backend Development  >  Detailed tutorial on upgrading PHP from 5.6 to 7.2 under Linux

Detailed tutorial on upgrading PHP from 5.6 to 7.2 under Linux

不言
不言forward
2019-02-18 14:11:3610722browse

This article brings you a detailed tutorial on upgrading PHP from 5.6 to 7.2 under Linux. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. helped.

The current PHP version is 5.6. Since the PHP version requirement of the project is 7.2, upgrade it

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 services

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

4. Delete the installed PHP related packages

yum remove php*
BashCopy

5. Install the new version of PHP

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

Currently (2018-5-4)

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

CentOs 7.x has 7.2 in the RPM source

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

6. Restart related services

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

Check the version again

php -v

The above is the detailed content of Detailed tutorial on upgrading PHP from 5.6 to 7.2 under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete