Topic: Setting an older PHP version as default

I had several PHP 7.x installed. Now I had to install PHP 8.0. Because of this the default PHP became version 8 as well. How can I change which version is used when running the command "php"?

Re: Setting an older PHP version as default

You can use the "scl" or "module" command to enable the version you want

$ php -v
PHP 8.0.21 (cli) (built: Jul  6 2022 10:13:53) ( NTS gcc x86_64 )

$ scl enable php72 "php --version"
PHP 7.2.34 (cli) (built: Jun  7 2022 10:31:33) ( NTS )

$ scl enable php72 bash
$ php -v
PHP 7.3.33 (cli) (built: Jun  7 2022 08:20:03) ( NTS )
$ exit
$ php -v
PHP 8.0.21 (cli) (built: Jul  6 2022 10:13:53) ( NTS gcc x86_64 )

$ module load php74
$ php -v
PHP 7.4.30 (cli) (built: Jun  7 2022 08:38:19) ( NTS )
$ module unload php74
$ php -v
PHP 8.0.21 (cli) (built: Jul  6 2022 10:13:53) ( NTS gcc x86_64 )

Also read:
https://blog.remirepo.net/post/2022/02/ … orkstation

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi