I have two PHP versions installed on the server 7.2
and 7.4
. Both are enabled as well.
There is a project running using PHP 7.2
. And I need to run a new project using PHP 7.4
. As I've mentioned, I don't use PHP-FPM. After some research, I should use a2dismod php7.2
and a2denmod php7.4
to stop 7.2
and start 7.4
version. But in this case, the current working project would stop working, since it's compatible with ver 7.2
.
So, any idea how can I config Apache to handle two different projects running on the same server one using PHP 7.2
and the other using 7.4
without using PHP-FPM?
As you use PHP as an Apache module, AFAIK, you can only load one PHP module per server instance.
However similar what is done with PHP-FPM, you can run two Apache server instances. One configured with the PHP 7.2 module, the other with the PHP 7.4 module.
Given the PHP 7.2 moduled Apache is the current server instance, it would proxy for the virtual host of the PHP 7.4 application to the new, second Apache server instance.
This would be comparable with Nginx and two PHP-FPM, just a different layout with Apache and Apache.
+----------------------------------------------------+
| +-------------+ + pool #1 |
| ,----> | PHP-FPM 7.2 | + pool #2 |
| +-------+ <--' +-------------+ + ... |
WAN <====> | Nginx | FCGI |
| +-------+ <--. +-------------+ + pool #1 |
| '----> | PHP-FPM 7.4 | + ... |
| +-------------+ |
+----------------------------------------------------+
+-------------------------------------------------+
| +-------------+ +-------------+ |
WAN <=====> | Apache #1 | <--------> | Apache #2 | |
| |.............| HTTP |.............| |
| | mod PHP 7.2 | | mod PHP 7.4 | |
| +-------------+ +-------------+ |
+-------------------------------------------------+
AFAIK you can only use the standard utilities like a2denmod(1) for the main server instance. Therefore make yourself comfortable with the server configuration, Apache is well documented and I personally like its configuration a lot. It's perhaps I started with Apache 1.3 ca.
However as it's 2023, Nginx + PHP-FPM is a very nice combo. Vanilla Nginx is a pretty decent powerhorse.