Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PHP as CGI script in CGI-BIN?
September 21, 2005, 3:24 pm
rate this thread
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.
<?php phpinfo(); ?>
Re: PHP as CGI script in CGI-BIN?
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 :: email@example.com :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool