You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andreas Hahnefeld <ah...@gmx.de> on 2004/03/18 18:18:51 UTC

[users@httpd] .php files as CGI without shebang

Hi,

I'm running Apache v1.3.29 on Debian and configured PHP and Perl as CGI...
'cause i wanted to wrap them with suExec...
Now I wanted to install some PHP-projects but mostly these are missing the
shebang line...
Have I to add to every .php-file a '#!/usr/bin/php' or is there a way to
tell Apache that special files have to be executed by a special program?
For example i want Apache to execute every .php file with '/usr/bin/php'...
I tried already the 'Action'-Directive but it didn't function as I wanted...
maybe it was my fault...

But I don't want to give up the CGI-concept and run them over mod_php 'cause
of security reasons...
Or is out there something like suExec which works with mod_php?

Or is there a misconfiguration on my side... I'm thankful for every hint...

Thanks
   Andreas Hahnefeld


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] .php files as CGI without shebang

Posted by Joshua Slive <jo...@slive.ca>.
On Thu, 18 Mar 2004, Andreas Hahnefeld wrote:
> I added a handler and defined 'Action' as described below:
>
>    AddHandler php-cgi .php
>    Action php-cgi /usr/bin/php

The second argument to Action must be the path to a cgi script in apache
web-space.  So, for example, you need to put your php binary in the
default cgi-bin directory and use
Action php-cgi /cgi-bin/php

But be sure to look at the cgi security with php issues:
http://www.php.net/manual/en/security.cgi-bin.php

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] .php files as CGI without shebang

Posted by Andreas Hahnefeld <ah...@gmx.de>.
> On Thu, 18 Mar 2004, Andreas Hahnefeld wrote:
> > I tried already the 'Action'-Directive but it didn't function as I
wanted...
> > maybe it was my fault...
>
> Tell us what you tried and how it failed.  The Action directive should be
> the simplest way to do this.

I added a handler and defined 'Action' as described below:

   AddHandler php-cgi .php
   Action php-cgi /usr/bin/php

But I'm always receiving an error while opening an .php-file through web
for example i try http://testsite.net/index.php then i receive the following
error:

    File does not exist: /<path on webserver to
website>/usr/bin/php/index.php

So I thought I missunderstood the meaning of this directive 'cause I don't
want to redirect the script...
I only want Apache to call /usr/bin/php to execute index.php...

Andreas

ps: Apache isn't chrooted nor jailed...


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] .php files as CGI without shebang

Posted by Joshua Slive <jo...@slive.ca>.
On Thu, 18 Mar 2004, Andreas Hahnefeld wrote:
> I tried already the 'Action'-Directive but it didn't function as I wanted...
> maybe it was my fault...

Tell us what you tried and how it failed.  The Action directive should be
the simplest way to do this.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org