In what scenarios would it be recommended to use PHP4 as a module and PHP5 as CGI, or vice versa?
In scenarios where you need to run both PHP4 and PHP5 on the same server, it is recommended to use PHP4 as a module and PHP5 as CGI to avoid conflicts between the two versions. This setup allows you to specify which version of PHP to use for different directories or virtual hosts on your server.
# Sample Apache configuration for running PHP4 as a module and PHP5 as CGI
AddHandler php4-script .php
Action php4-script /cgi-bin/php5.cgi
<Directory "/path/to/php4/files">
AddHandler php4-script .php
</Directory>
<Directory "/path/to/php5/files">
AddHandler php5-script .php
Action php5-script /cgi-bin/php5.cgi
</Directory>