Re: Apache+PHP: more "universal" config

Joachim Durchholz <jo-JN0m9dTiHHGb9/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Sven Köhler schrieb:
> - 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.

It is, though you probably won't like the answer.

The

   Action php-fastcgi /cgi-bin/php

directive tells that CGI scripts are handled using the URL (sic!) 
http://your-virtual-host.de/cgi-bin/php, regardless of how the "php" 
executable went to that part of URL space (DocumentRoot is one way to do 
it, others are Alias, ScriptAlias, and RewriteRule).

That's why the module version of PHP will check a few environment 
variables to see whether it's actually been called from Apache, and 
refuse to do anything if it isn't...

The FastCgi version of PHP (and probably any FastCgi script) won't do 
anything useful if started via URL (it's expecting to be fed through 
stdin, which won't do it much good if called directly from Apache - I 
think it will simply terminate itself with a timeout, ultimately giving 
the visitor a 500 error - I haven't checked that).

I don't understand why Apache doesn't offer a way to specify the handler 
via a filesystem path. Or maybe I overlooked it. Or maybe there's an 
Apache module somewhere that does this - I'd be interested to hear about 
such a thing.


Whatever.

Re your question: You could place php-cgi in some directory, Alias or 
ScriptAlias it to a URL in the main configuration so that it's available 
in all virtual hosts. This should achieve what you want: a single 
executable that serves all virtual hosts.

Regards,
Jo

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.