0

My production Centos 7 machine is running PHP 7.4 but I 'd like to test code against PHP 8. Before a few days,in formatting a new server, I tried yum-config-manager --enable remi-php8 but this broke the setup, for my PHP code had a TCPDF issue that wouldn't work in PHP 8, so I had to downgrade to PHP 7.4.

Is there anyway in Centos to have both versions and switch on demand ?so I can test but at the same time keep the working part intact.

Running over nginx.

2

Software collections (SCL) are designed for parallel installation beside the system default version, thus allowing to run multiple versions simultaneously.

This is described in PHP Configuration Tips, especially the switch to FPM for httpd users (as mod_php, used by default in CentOS 7), allow only a single version). Nginx users always use FPM.

In remi repository you can find PHP 5.6 to 8.0 as SCL.

For a proper installation, follow the wizard instructions (and choice "multiple versions").

0

I had a similar goal, and went a slightly different way:

I wanted to be able to test with newer versions of PHP as well as the production version, and run testcases against them.

Code centric Development environment

I started by using , which basically is a way of provisioning your VMs. the configuration is in code, in form of a VagrantFile. I liked the way this allowed me to set up completely equal environments, and bracnh off to test new versions of PHP without changing the rest of the system. The way I set it up, it basically maps your src folder to the vm, and you are off.
This also meant that any developer checking out the code will be able to spin up a development environment which is exactly the same as the one all the other developers are using.

Going further

This is a further development of the scenario I have described, and is essentially an alternative route
After some iterations, and a desire to automate the testing, which meant spinning up a test environment when I needed to test, with the same specs as my prod environment, I decided to move to . the overhead is less, and it appears that docker is easier to run on different OSes, so essentially I did the same sort of thing in docker, which means that setting up CI/CD is easy since a lot of those tools have docker integrations built in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.