I have two PHP versions installed on the server, 7.2
and 7.4
. Both versions are enabled.
There is currently a project using PHP 7.2
. I need to run a new project using PHP 7.4
. As I mentioned before, I don't use PHP-FPM. After some research I should use a2dismod php7.2
and a2denmod php7.4
to stop the 7.2
version and start ;7.4
version. But in this case, the currently running project will stop working because it is compatible with version 7.2
.
So, is there a way to configure Apache without using PHP-FPM so that it can handle two different projects running on the same server, one using PHP 7.2
, Another one using 7.4
?
When using PHP as an Apache module, as far as I know, only one PHP module can be loaded per server instance.
However, similar to PHP-FPM, you can run two Apache server instances. One is configured with PHP 7.2 modules and the other is configured with PHP 7.4 modules.
Assuming the PHP 7.2 module for Apache is the current server instance, it will proxy the PHP 7.4 application's virtual host to the new second Apache server instance.
This is similar to Nginx and two PHP-FPMs, just using different Apache and Apache layouts.
As far as I know, you can only use standard utilities like a2denmod(1) for the main server instance. So please familiarize yourself with the server configuration, Apache has great documentation and I personally like its configuration a lot. Probably because I've been using it since about Apache 1.3.
However, since it is 2023, Nginx PHP-FPM is a very good combination. The original Nginx is a pretty good and powerful tool.