> If you put this script into a file (.cgi) and give it executable
> permissions, you can run it from the command line
> ------------PHP CODE START------------
> #!/usr/bin/php
> <?php
> print "Hello";
> ?>
> ------------PHP CODE END------------
> and the Content-Type header is added by PHP. But when I put it in my
> cgi-bin directory it would not execute from a browser - I got internal
> server error.
> The error log said "Premature end of script headers."
> Has anybody been able to find a way round this problem? Running PHP NOT as
> a module?

You will need to use:

AddType application/php-cgi .phpcgi
Alias phpdir "/path/to/phpdirectory/"
Action application/php-cgi "phpdir/php"

Alter your file to end in .phpcgi, not .cgi
.cgi is probably already taken by, errr, Perl?, and you'll just screw that
up if you leave it.

This definitely can be done -- I've used it to run 4 or 5 different versions
of PHP simultaneously to track down a bug, using extensions like .php305
.php306 .php307 and matching AddType/Action lines.  I didn't actually use
Alias, but I think it's cleaner to do that.

You definitely need a unique mime-type as well.  You'll confuse Apache no
end if you assign the same mime-types to both Module and CGI PHP.

WARNING [EMAIL PROTECTED] address is an endangered species -- Use
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to