php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20356 Wrong header, output broken
Submitted: 2002-11-11 06:40 UTC Modified: 2002-11-15 02:21 UTC
From: janus at linux-de dot org Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4CVS-2002-11-11 OS: linux
Private report: No CVE-ID: None
 [2002-11-11 06:40 UTC] janus at linux-de dot org
It's just like http://bugs.php.net/bug.php?id=14751
Except now i'm confirming that with Apache2 in SSL-mode.
It has to be a PHP problem, because a HTTP-Header looks like this:
----------
0

HTTP/1.1 200 OK
Date: Mon, 11 Nov 2002 11:31:32 GMT
Server: Apache/2.0.43 (Unix) mod_ssl/2.0.43 OpenSSL/0.9.6g
----------
Yes, THERE IS a "0\n\n" before the real header... and that happens ONLY with PHP, all other CGI-Scripts work fine.

PHP is configured like this in htt.conf:
----------
ScriptAlias /php4-cgi-bin-dir "/pool/system/php4/bin"
Action application/x-httpd-php /php4-cgi-bin-dir/php
AddHandler application/x-httpd-php .php
----------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-11 06:51 UTC] derick@php.net
recategorize
 [2002-11-11 10:19 UTC] rasmus@php.net
This looks like an Apache2 bug to me.  When running PHP as a CGI it is the web server that is responsible for sending back the 200 OK and making sure nothing gets sent back before it.  PHP as a CGI has been tested for years with dozens of other web servers.
 [2002-11-11 10:42 UTC] janus at linux-de dot org
Hm, but then the problem would also accour with other languages... but it doesn't.
 [2002-11-11 10:47 UTC] rasmus@php.net
That doesn't change the fact that A CGI can architecturally not cause what you are seeing and if it does then the server is buggy.  And yes, Apache2 is a very buggy server at this point and should not be used in production.
 [2002-11-11 11:10 UTC] janus at linux-de dot org
Same for PHP i would say, but that doesn't help now.
But the CGI has to send the header itself, so i think it is logical that apache can't be the source of the problem.
My perl scripts work fine with SSL, python and ruby are also doing the right output, only php doesn't, so why should i believe that it's an apache2 problem? Or are you just pushing the blame on someone else?
Furthermore i've got the same problems with apache1, as others too.
 [2002-11-11 11:13 UTC] rasmus@php.net
Your CGI script does not send the HTTP/1.1 200 OK response, the web server does.  No matter what the CGI script returns, the server cannot legally send anything before that header.  If it does then the server is broken by definition.  There is just no arguing that point.

But what exactly does your cgi script generate when you run it from the command line?
 [2002-11-11 12:20 UTC] janus at linux-de dot org
Which one? PHP or another one?
Ther error occours even if i let the script print "hello world".
It's really boring... i only want to run php in a safe way... and because the perchild-mpm for apache2 isn't working yet, i have to use suexec, so every script runs with the right permission, that's the only reason why i'm using the cgi-version of php.
If there's another safe way, i'll take a look at it.
 [2002-11-13 08:02 UTC] janus at linux-de dot org
I've posted it to the apache-mailinglist... i need a solution, so i've to ask around :)
If i've new informations, i'll post'em here.
 [2002-11-13 08:53 UTC] janus at linux-de dot org
I've to excuse.
Recently i got the same problem with one of my ruby-scripts, i'm sorry for the rebukes.

Best regards,
simon
 [2002-11-15 01:46 UTC] janus at linux-de dot org
So now i've setup a 'test-suite'...
HTTP-Version: http://xmail.linux-de.org/test/
HTTPS-Version: https://mail.linux-de.org/test/

There are php.html, perl.html and ruby.html... all cgi-scripts printing
the ENV-Vars in a frameset.
PHP will fail nearly every time in one frame at minimum, the others
(perl and ruby) work nearly every time correct (it's absolutely
acceptable).

So now tell me, is it an PHP-Problem or Apache2? (I myself think again
it's php).
 [2002-11-15 02:21 UTC] rasmus@php.net
As explained on the apache-users list, this cannot be a PHP bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 17:01:29 2024 UTC