How to switch the php version? If my server has more than one PHP installed.

I installed two php, on the CentOS7.2 server, one is php7.1 installed using the source code make, and the other is php7.0 installed using yum. I want to use php7.0 instead of php7.1 . How can it be implemented?

-sharp php -v
PHP 7.1.16 (cli) (built: Jul  2 2018 05:31:51) ( ZTS )

-sharp whereis php
php: /usr/bin/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/local/bin/php /usr/share/php /usr/share/man/man1/php.1.gz    

my php7.1 is installed in / usr/local/php-7.1.16 .

Mar.24,2021

apache can load the module of php7.0. Cli will rename the 7.1binary executable file to php7.1, and transfer the 7.0soft link to / usr/bin

.
ln -s /path/to/binary/php7.0 /usr/bin/php

add PHP of 7.0 to the linux environment variable


put PHP 7.0in / usr/bin

< H2 > better practices < / H2 > Use docker after

, it's much more convenient


not to mention that configuring / extending etc, is all hooliganism,

Menu