I am trying to run PHP 8.1, and PHP 8.2 simultaneously on a RHEL 8 server using Apache. Here are the steps I’ve taken:
Installed PHP Versions:
Used the remi repository to install PHP 8.1, and PHP 8.2.
Commands used: sudo dnf module install php:8.1
sudo dnf module install php:8.2
Configured Apache:
Created separate virtual host configurations in /etc/httpd/conf.d/ to use different PHP versions.
Switched CLI PHP Versions:
Used sudo alternatives –config php to switch between PHP versions on the command line.
Issues Encountered
- Installation Conflicts: Faced conflicts between PHP versions during installation from the remi repository.
- Apache Configuration: Apache is not correctly interpreting different PHP versions for separate virtual hosts.
- CLI Version Switching: The update-alternatives tool changed the CLI version, but it didn’t affect Apache’s handling of PHP versions as expected.
What I Tried
- Installed PHP 8.1 and PHP 8.2: Used remi repository on RHEL 8.
- Configured Apache: Set different PHP versions for different virtual hosts.
- Switched PHP Versions: Used update-alternatives to change CLI PHP version.
What I Expected
- Run different PHP versions for different virtual hosts.
- Seamless PHP version switching for CLI and Apache.
What Actually Happened
-
Installation conflicts between PHP versions.
-
Apache not handling different PHP versions correctly.
-
CLI version switching didn’t affect Apache.
-
How to resolve conflicts when installing multiple PHP versions from remi on RHEL 8?
-
Correct Apache configuration for multiple PHP versions?
-
Manage and switch CLI PHP versions without affecting Apache?
-
Best practices for running multiple PHP versions on RHEL 8?
Kindly share the detailed steps which anyone follow to achieve this task.
2
Answers
I actually saw this method of using
.htaccess
this morning.httpd.conf
.htaccess
"remi" repository provides Software Collections (SCL) designed for parallel installation of multiple versions
For a proper repository configuration and usage, follow the Wizard instructions
You can also read how I use SCL for my PHP workstation