Home  >  Article  >  Backend Development  >  How to change php version number in linux

How to change php version number in linux

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-02 16:53:532581browse

How to change the PHP version number in Linux: First use the "find" command to find the location of each PHP version; then use the "ln" command to create a soft link containing the path to the new PHP version; finally use the "export" command Just add the soft link to the PATH path.

How to change php version number in linux

The operating environment of this article: centos7 system, PHP5.4&&PHP5.5 version, thinkpad t480 computer

Operation steps:

1. Use the find command to find where php is.

#find / -name php

How to change php version number in linux

2. The ln command (a lot of resources on Baidu) is mainly used to create soft connections

Now I mainly want to change the 5.4 version to the 5.5 version:

#ln -s /usr/local/php-5.5/bin/php(你想要换成的php版本的路径) /usr/sbin/php(最后一个php可以换成你自己喜欢的名字,最好php吧)

3. The export command will add the soft connection to the PATH path

#export PATH="$PATH:/usr/sbin/php"

Add the connection you prepared above That’s it, don’t miss the colon in the middle, it’s used for segmentation

Finally, look at the effect

#php -v

How to change php version number in linux

Recommended tutorial: php Video tutorial, Linux video tutorial

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