The Server
I have a development server that I\'m using to host my current projects. Here are some stats:
root@myserver:/usr/bin $ ca
The problem is that mod_php
still handles .php
files, even when the CGI handler is set for a vhost.
To fix that, the <Directory>
in the vhost needs to have a SetHandler
directive:
Action php-cgi /cgi-bin-php/php-cgi-5.2.11
<FilesMatch \.php$>
SetHandler php-cgi
</FilesMatch>
</Directory>
I've updated the tutorial.
A good alternative is suPHP.
If set up properly, you can have as many handlers, as you wish; even for different directories within a virtual host.
For added security, there's suPHP's "paranoid" mode in which you assign a Unix user and group to a virtual host and the scripts will be run as that user.
My suPHP config looks like that:
...
[handlers]
;Handler for php-scripts
x-httpd-php=php:/usr/bin/php4-cgi
x-httpd-php5=php:/usr/bin/php5-cgi
;Handler for CGI-scripts
x-suphp-cgi=execute:!self
...
Within a simple .htaccess
file it is possible to have scripts run using different versions of PHP:
<FilesMatch \.php$>
SetHandler x-httpd-php
</FilesMatch>
<FilesMatch \.php5$>
SetHandler x-httpd-php5
</FilesMatch>
# etc...
Hope that helps.