A couple of additional comments on this. This is not a complete fix as a blank line still gets printed and generates a Warning in some cases. To work around this, set output_buffering to On in your php.ini file.
----- Original Message ----- From: "Michael Johnson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 28, 2001 7:59 AM Subject: [PHP-INST] Fix for CGI PHP (no more #!/php in displayed content) > As some of you are aware, PHP 4.0.6 has a small glitch on the cgi (rather > than mod) side of things that renders it utterly useless for all practical > purposes. To use a php script via a cgi-script handler (on *nix), obviously > one must include '#! /path/to/php' line as the first in the file. > Unfortunately, the way the php binary handles this line is flawed. Rather > than ignoring this first line, it prints it as the first line of html. This > happens only when running through a web server and not on the command line. > There may be a better way to submit this fix, but as I am new at this, here > it is: > > Open sapi/cgi/cgi_main.c in your favorite text editor. > > Jump to line 702. > > Change this one line from this: > } else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) { > to this: > } > if (file_handle.handle.fp && file_handle.handle.fp!=stdin) { > > I have tested this and it works fine (i.e. it doesn't break running php via > the command line). > > Since I am not familiar with the inner workings of PHP or the C proramming > language, I don't know if there is a better fix, but for now, this seems to > be the best one available. > > > > -- > PHP Install 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] > > -- PHP Install 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]