Home >Backend Development >PHP Problem >How to change the php version of centos

How to change the php version of centos

藏色散人
藏色散人Original
2021-10-18 10:05:134695browse

How to change the centos php version: 1. Use "php -v" to view php version information; 2. Execute the "locate */php" command; 3. Modify the php version loading path in the environment variable file; 4. Execute "source /etc/profile".

How to change the php version of centos

The operating environment of this article: centOS6.8 system, PHP7.2 version, DELL G3 computer

How to change the php version of centos ?

centos switch php version

The php version php5.3 to php7.2 is installed on the centos server, and the default usephp -v , the PHP version information viewed is:

Modify the environment variable file: vim /etc/profile
shift g jumps to the last line of the environment and sees:

php is loaded by default under /usr/local/php/bin, so the version It is 5.6

Next, you need to find the location of the php execution program of version 7.2, execute locate */php to see:

You can see php7. The location of version 2 is: /usr/local/php72/bin/php

So, modify the php version loading path in the environment variable file to /usr/local/ php/bin is changed to /usr/local/php72/bin.

Execute source /etc/profile to make the modification effective.

Execute againphp -vSee that the current default php has been changed to php7.2 version

Recommended study: " PHP video tutorial

The above is the detailed content of How to change the php version of centos. 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