Re: Fix for CGI PHP (no more #!/php in displayed content)

From: Date: Wed, 28 Nov 2001 14:14:32 +0000
Subject: Re: Fix for CGI PHP (no more #!/php in displayed content)
References: 1  Groups: php.dev php.install 
Request: Send a blank email to php-dev+get-71931@lists.php.net to get a copy of this message
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" <michael@apomorph.com> To: <php-install@lists.php.net>; <php-dev@lists.php.net> 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: php-install-unsubscribe@lists.php.net > For additional commands, e-mail: php-install-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#71931) next »