P粉1387117942023-08-17 10:53:01
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.
+----------------------------------------------------+ | +-------------+ + 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 | | | +-------------+ +-------------+ | +-------------------------------------------------+
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.