httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan von Krawczynski <>
Subject Re: [users@httpd] How to run php with virtual host based uid/gid on apache2 ?
Date Fri, 27 Aug 2004 11:06:07 GMT
On Fri, 27 Aug 2004 12:42:17 +0200
"Robert Andersson" <> wrote:

> Stephan von Krawczynski wrote:
> > >     AddType application/x-httpd-php .php
> > >     Action application/x-httpd-php "/usr/bin/php"
> >
> > I tried that with Apache 1.3 (for a test), but apache tried to execute
> > "/usr/bin/php/<myscript.php>" then, which obviously failed.
> > I guess I forgot something obvious, can you please give an additional
> > advise
> Seems like I missled you; Action takes a URI not a system path.
> I did a quick test (with Apache 2), like this:
> - I put a copy of the php binary in a web root.
> - Had the above AddType and Action, but with "/php" as second
>   parameter.

I tried that again under 1.3.28 but no good. It still tries to find a
file "/php/test.php" which is wrong.

> When requesting a .php file, it was parsed through CGI. However, some ENVs
> gets screwed up (eg. SCRIPT_FILENAME), so perhaps it might be good to make a
> wrapper.
> In a mass-vhost situation, you might be able to do something like this:
>     Alias /php-cgi /usr/bin/php
>     AddType application/x-httpd-php .php
>     Action application/x-httpd-php /php-cgi

Tried that too and apache tried to find
"/php-cgi/test.php" after that, so no success.
> The alias would allow you to not have to put a copy/symlink to PHP in each
> vhost's document root.

That surely would be great. The only thing I do not understand (and my apache
obviously neither):
How can apache see from above config that it should use my CGI-wrapper suexec
for the above case, that ".php" should be treated just like ".cgi" (as an
example) only with using "/usr/bin/php" as interpreter?
I googled around a bit and found out most people think your "AddType/Action"
idea should work, which seems to show that they actually did never test that,
at least not under unix/linux.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message