Apache+PHP: more "universal" config
Sven Köhler <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
i know, that i can copy php to the cgi-bin directory, but i don't want
to do that. What i want, is a more universal config, that tells
mod_fastcgi to execute every file with the extension "php" with a
certain fastcgi-server.
FastCgiServer /path/to/cgi-bin/php
<Location /cgi-bin/php>
SetHandler fastcgi-script
</Location>
AddHandler php-fastcgi .php .php4
Action php-fastcgi /cgi-bin/php
Apache will always try to resolve the action's path relative to the
ServerRoot - or DocumentRoot i guess.
But i want an apache-wide config, that valid for all virtualhosts at
once. If i do the "place a php-shellscript into the
cgi-bin-folder"-trick, i would have to do that for every virtualhost -
and in addition, i would need one FastCgiServer-directive for each copy
of php - for each cgi-bin folder.
So what i'd really like to do, is the following:
- tell mod_fastcgi that there is a server at /usr/bin/php-cgi
- tell mod_fastcgi to use /usr/bin/php-cgi for each *.php file
- tell apache to use mod_fastcgi for each *.php file
That doesn't seem to be possible.
Here's how a possible config could look like:
FastCgiServerHandler php-fastcgi /usr/bin/php-cgi
AddHandler php-fastcgi .php .php4
So FastCgiServerHandler defines a new handler names "php-fastcgi" which
can be used with AddHandlet to connect it to the all files with the
extensions "php" and "php4".
A more advanced config could be:
FastCgiServerHandler php4-fastcgi /usr/bin/php4-cgi
FastCgiServerHandler php5-fastcgi /usr/bin/php5-cgi
FastCgiServerHandler php5-test /usr/bin/php5-cgi -user nobody
AddHandler php4-fastcgi .php4
AddHandler php5-fastcgi .php5 .php
AddHandler php5-test .test
It defines 3 servers for php4, php5 and a special handler, where the
php5 server is started as a different user. Then the handlers are mapped
to the different file extenstions.
So has anybody thought about that already? Is there any extention/patch
to mod_fastcgi? mod_fcgid doesn't seem to allow that either :-(
Unfortunatly, mod_fastcgi relies on apache's Action-directive to use it
for PHP. This is not very convenient.
Thx
Sven
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/