Topic: Single version with php56, php71, php72 installed as SCL

Hi,

I'm running CentOS 7.5 and want to have the possibility to switch php version as needed.
I don't need different versions for different applications but rather a way to switch php version globally on the server.
Basically using Apache's mod_php.

Here are the steps I've performed:

installed the EPEL repository
installed Remi's safe repository
yum install yum-utils

yum install php56 php56-php ...
yum install php71 php71-php ...
yum install php72 php72-php ...

I didn't install php from base.

So to enable php56 for ex, I did:

module load php56

At this point both apache/web and cli versions were the same php 5.6.

When I want to switch to php72 I do the following:

module unload php56
module load php72
This is sufficient for cli version but then I need to comment the lines:

#LoadModule php5_module modules/libphp56-php5.so
and
#LoadModule php7_module modules/libphp71.so
in
/etc/httpd/conf.modules.d

Restart apache and now phpinfo(); shows php 7.2

Is this the right way of doing? I mean did I miss something?
Also do I have to install php from base or it's not mandatory?

Thanks

Re: Single version with php56, php71, php72 installed as SCL

I recommends you read:
https://developers.redhat.com/blog/2017 … tion-tips/

And
https://blog.remirepo.net/post/2016/04/ … orkstation

So: using mod_php is, IMHO, not the right way.
Using FPM and 1 vhost per version seems far simpler, especially on a dev machine.

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Single version with php56, php71, php72 installed as SCL

Using FPM would be a challenge currently. I'll probably take a vhost only for that purpose and try to understand thoroughly.

The server I'm setting up is to be my production server. Currently I'm on shared hosting where I don't control anything.
So I'm looking for a simpler configuration to begin with but still having multiple php versions available.

Please let me know if I should install php from base, besides the three versions I've installed?


Thanks

Re: Single version with php56, php71, php72 installed as SCL

> Using FPM would be a challenge currently.

FPM is now the default configuration in various distribution, including Fedora 27+ and RHEL 8
This is usually transparent for the application.

> Please let me know if I should install php from base, besides the three versions I've installed?

No

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test