php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23632 incorrect headers from php-cgi, redirect fails, still in 4.3.2-RC3-dev
Submitted: 2003-05-14 20:47 UTC Modified: 2003-05-15 16:42 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: 1inside at gmx dot net Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.1 OS: linux 2.4.18-3
Private report: No CVE-ID: None
 [2003-05-14 20:47 UTC] 1inside at gmx dot net
hello,

after upgrading from 4.1.2 to 4.3.1 the php-cgi seems to send incorrect headers. i tried the php4-STABLE-200305142330, too but the problem persists.

os:        linux 2.4.18-3
webserver: apache1.3.27
php:       4.3.2-RC3-dev (php4-STABLE-200305142330)
           php4.3.1
           ./configure --with-mysql --with-apxs=/home/service/apache_1.3.27/bin/apxs

http://bugs.php.net/bug.php?id=23184:
my var_dump(ini_get("cgi.rfc2616_headers")) resulted in an empty string 


first test: /cgi-bin/test
-------------------------
#!/usr/bin/php4
<php
   echo "blah";
?>

bash> telnet mydomain.net 80
Trying 123.234.123.234...
Connected to mydomain.net.
Escape character is '^]'.
GET /cgi-bin/test HTTP/1.1
HOST: mydomain.net

HTTP/1.1 500 Internal Server Error
Date: Thu, 15 May 2003 01:01:44 GMT
Server: Apache/1.3.27 (Unix)
Connection: close
Transfer-Encoding: chunked

apache error log:
-----------------
bash> tail error-log
[Thu May 15 03:01:47 2003] [error] [client 111.222.111.222] Premature end of script headers: /www/virtual/www.mydomain.net/cgi-bin/test


now modified: /cgi-bin/test2 this one works
-------------------------------------------
#!/usr/bin/php4
<?php
   echo "Content-Type: text/html\n\n";
   echo "blah";
?>

bash> telnet mydomain.net 80
Trying 123.234.123.234...
Connected to mydomain.net.
Escape character is '^]'.
GET /cgi-bin/test2 HTTP/1.1
HOST: mydomain.net

HTTP/1.1 200 OK
Date: Thu, 15 May 2003 01:09:52 GMT
Server: Apache/1.3.27 (Unix)
Transfer-Encoding: chunked


last one: /cgi-bin/test3 redirect fails...
------------------------------------------
#!/usr/bin/php4
<?php
   header( "Location: http://www.php.net" );
?>

bash> telnet mydomain.net 80
Trying 123.234.123.234...
Connected to mydomain.net.
Escape character is '^]'.
GET /cgi-bin/test3 HTTP/1.1
HOST: mydomain.net

HTTP/1.1 500 Internal Server Error
Date: Thu, 15 May 2003 01:17:51 GMT
Server: Apache/1.3.27 (Unix)
Connection: close
Transfer-Encoding: chunked

apache error log:
-----------------
bash> tail error-log
[Thu May 15 03:17:55 2003] [error] [client 111.222.111.222] Premature end of script headers: /www/virtual/www.mydomain.net/cgi-bin/test3


if i instead use the apache module with /htdocs/test4.php:
<?php
   header( "Location: http://www.php.net" );
?>

there is no problem at all, only the cgi scripts seem to be affected. any help is really appreciated.

thanks in advance and please take my apologies if i created a duplicate!

Michael

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-15 09:43 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You need to configure cgi correctly. 
 [2003-05-15 16:42 UTC] 1inside at gmx dot net
i am sorry that the cli/cgi difference concerning the header output did not get through to me earlier.

for everyone experiencing this kind of problem, more to find here http://www.php.net/manual/en/features.commandline.php

thanks to all of you for developing php.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Aug 02 23:01:23 2021 UTC