Home  >  Article  >  Backend Development  >  How to modify the default php version

How to modify the default php version

藏色散人
藏色散人Original
2023-01-20 09:32:403920browse

Methods to modify the default php version: 1. Check the installation information through "yum list installed | grep php"; 2. Use "yum remove php" to uninstall PHP; 3. Change the RPM source; 4. Through "yum install -y" to install the required PHP version.

How to modify the default php version

The operating environment of this tutorial: centOS 7 system, PHP7.1 version, DELL G3 computer

How to modify the default php version ?

centOS 7 Modifies the default PHP version

When building a LAMP or LNMP environment on a Linux server, during the installation of PHP, if you directly use the yum install php command PHP 5.4.* version will be installed by default. If you want to install the PHP 7.* version, there are two methods, as follows:

(1) Download the corresponding PHP source code package for compilation and installation (not explained this time).

When using compilation and installation, pay attention to configuring each path.

(2) Modify the source and use the yum command to install.

1) Check whether the old version of PHP is installed on this machine. If so, remove it

1. yum list installed | grep php #Check the installation information

2. yum remove php #Uninstall PHP

3. You also need to uninstall PHP's dependent environment. Use yum remove software names to delete them one by one. Pay attention to the order of each dependency. If you mention that the software depends on other software during deletion, uninstall the latter first. And so on.

2) Replace the RPM source

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3) Start installing the PHP version

1. Install PHP 7.1.*

yum install -y 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

2. Install PHP 7.2

yum install -y 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

3 Check the PHP version

php -v

How to modify the default php version

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to modify the default 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