Home > Backend Development > PHP Tutorial > 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

不言
Release: 2023-04-05 10:04:01
forward
10770 people have browsed it

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
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 services

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

4. Delete the installed PHP related packages

yum remove php*
BashCopy
Copy after login

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

6. Restart related services

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

Check the version again

php -v
Copy after login

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!

Related labels:
php
source:csdn.net
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