PHP as CGI script in CGI-BIN?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
    I am having problems trying to run some php scripts in cgi.  I have Apache 2.0+ and PHP 4.3.   Perl works fine
with CGI and PHP works find as an Apache module.  Whenever I attempt to run the php script through a URL with the
cgi-bin, it asks if I want to open or download the file.  Cgi files execute fine though.  Can anyone think of anything I
might be missing in any of the conf files?
    Included is an example of one of my php scripts.  Thank you for any advice.

#!/usr/bin/php -q

<?php phpinfo(); ?>  

Re: PHP as CGI script in CGI-BIN?

On Wed, 21 Sep 2005 15:24:05 GMT, (Keith) wrote:

Quoted text here. Click to load it

 The -q flag suppresses the Content-type header, IIRC. You don't want to
suppress this, you want to let PHP send it unless you are specifying one
yourself with header().

 Also, make sure the PHP you're referring to is the CGI version of PHP - as
there is a separate command-line version as well (the "CLI" SAPI). Having not
had much experience running as CGI (I always use the webserver module version)
I can't say for sure if these two are fundamentally different, but they
certainly appear to be built separately at least in PHP 5.

 What does "php -v" say?
Andy Hassall :: :: :: disk and FTP usage analysis tool

Re: PHP as CGI script in CGI-BIN?

 I found what the problem was.  I was using the php module rather than
the php-cgi module.  Thanks!


Site Timeline