php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24916 IIS6.0 & CGI PHP header()
Submitted: 2003-08-02 08:06 UTC Modified: 2003-08-05 10:45 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: sadun at isikun dot org Assigned:
Status: Not a bug Package: IIS related
PHP Version: 4.3.2 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2003-08-02 08:06 UTC] sadun at isikun dot org
Description:
------------
;changes in php.ini

error_reporting  =  E_ALL & ~E_NOTICE
register_globals = On
include_path = ".;W:\wwwroot\includes"
extension_dir = "W:\php\extensions"
cgi.force_redirect = 0
cgi.redirect_status_env = ENV_VAR_NAME
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1 
upload_tmp_dir = "W:\php\phpupload"

extension=php_mbstring.dll
extension=php_imap.dll
extension=php_gd2.dll

session.save_path = "W:\php\phpsession"
session.auto_start = 1




Reproduce code:
---------------
Header("Location: Http://".$GLOBALS["HTTP_HOST"]."/main.php?");

// i checked URL is correct 

Expected result:
----------------
redirect to url

Actual result:
--------------
CGI Error
The specified CGI application misbehaved by not returning a complete set of, HTTP headers.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-02 08:11 UTC] sadun at isikun dot org
it was working fine with ISAPI on IIS 6.0

but i need to use like CGI and i faced with CGI Error. i have searched the net but i can't find anything about it.
 [2003-08-02 11:24 UTC] iliaa@php.net
Please reply with all the headers php sends back.
 [2003-08-03 13:24 UTC] edink@php.net
And try PHP-4.3.3RC2 while you're at it.
 [2003-08-04 07:54 UTC] sadun at isikun dot org
SORRY PREVIOUS POST IS SEND HEADERS HERE ARE RECEIVED HEADERS
-----------------------------------------------------

--------------------------
index.php WITH LOGIN FORM:
--------------------------
(Response Status)	HTTP/1.1 200 OK
Cache-Control	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma	no-cache
Content-Type	text/html
Expires	Thu, 19 Nov 1981 08:52:00 GMT
Server	Microsoft-IIS/6.0
X-Powered-By	PHP/4.3.2
Set-Cookie	PHPSESSID=d67841ed88adca6bc603bd7e480d90ec; path=/
Set-Cookie	student_session_id=0
X-Powered-By	ASP.NET
Date	Mon, 04 Aug 2003 12:53:11 GMT
Connection	close

--------------------------
AFTER SUBMITING POST FORM:
--------------------------

(Response Status)	HTTP/1.1 502 Bad Gateway
Content-Length	232
Content-Type	text/html
Server	Microsoft-IIS/6.0
X-Powered-By	ASP.NET
Date	Mon, 04 Aug 2003 12:55:10 GMT

-----------------------

now i gonna try 4.3.3 RC2
 [2003-08-04 08:21 UTC] sniper@php.net
Comment this line out: cgi.redirect_status_env = ENV_VAR_NAME

 [2003-08-04 08:38 UTC] sadun at isikun dot org
;cgi.redirect_status_env = ENV_VAR_NAME

no changes header("Location: URL_FOO");

can't be send in 4.3.2 IIS6.0 with CGI
 [2003-08-04 09:02 UTC] sadun at isikun dot org
PROBLEM IS SOLVED WITH PHP4.3.3RC2

thanks for your help
 [2003-08-04 12:03 UTC] sadun at isikun dot org
!!! UPS.. NOW I CAN REDIRECT WITH GET BUT NOT WITH POST

i don't really know if my codes make this problem but except "IIS 6.0 CGI" i try it several apache servers 1.x 2.x both on unix and winNT platforms and it always worked.

HERE ARE THE HEADERS
------------------------------------------------

 19:54:03.732	0.203	*	POST	INET_E_REDIRECT_FAILED	text/html	http://webgroup.isikun.edu.tr/main.php

-------------------------------------------------

(Response Status)	HTTP/1.1 302 Redirect
Cache-Control	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma	no-cache
Content-Length	161
Content-Type	text/html
Expires	Thu, 19 Nov 1981 08:52:00 GMT
Location	Http://webgroup.isikun.edu.tr/main.php
Server	Microsoft-IIS/6.0
X-Powered-By	PHP/4.3.3RC2
Set-Cookie	PHPSESSID=ad1a199467d611ed39773d5e56358239; path=/
Set-Cookie	student_session_id=6c9009a421a409c1385dde256b693840
X-Powered-By	ASP.NET
Date	Mon, 04 Aug 2003 17:00:28 GMT

------------------------------------------

sorry for disturbing
 [2003-08-04 12:25 UTC] sadun at isikun dot org
I FOUND THE PROBLEM IF YOU REDIRECT USER TO SAME PHP FILE IT MAKES AN ERROR LOOP.

let's say i execute a code at main.php and if i redirect user to main.php you can see in the headers that it makes a loop with errors at headers with "INET_E_REDIRECT_FAILED" but you can redirect anywhere else except same file...

CODE
---------------------
<?

header("Location: http://webgroup.isikun.edu.tr/arge/header.php");

?>

ERROR AT HEADERS
---------------------
 20:15:48.279	0.109	*	GET	INET_E_REDIRECT_FAILED	text/html	http://webgroup.isikun.edu.tr/arge/header.php
 [2003-08-04 13:55 UTC] sadun at isikun dot org
i forgot to pick Status Open  :)

still have the problem which is at the top...
 [2003-08-04 20:25 UTC] iliaa@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.

It would seem to me that if you make a redirect loop that the webserver may detect such an occurance and throw an error as it happens in your case. This is hardly a PHP bug.
 [2003-08-05 01:16 UTC] sadun at isikun dot org
INET_E_REDIRECT_FAILED is kind of an error that exe can cause. for more information look at TechNET

"INET_E_REDIRECT_FAILED (0x800C0014L) -2,146,697,196 Attempt to redirect the navigation failed."

the case is simple. login form action goes to main.php and if login is correct it sets SESSION and COOKIE then it redirects user to main.php. After redirection (which is need to set cookies) main.php checks users cookie and sessions if they are valid bla bla bla....

as you seee there are no loop in redirections. there is only one redirection which is done in main.php for one to set cookies. and if it is not a bug why isapi module works well ???

i wish you could fix it. cause we are waiting for this debug. we can't change all authentication for one redirection bug for spesific combination.
 [2003-08-05 10:45 UTC] sniper@php.net
Please stop reopening this, there is no bug.
(ask support for this kind of obvious configuration errors elsewhere, like php-general@lists.php.net for example)

 [2003-08-19 17:33 UTC] jeff at mos dot org
I see that this has been marked 'bogus', but I think that there is something going on.

I'm running PHP 4.3.2 on IIS 5.0 with FastCGI (isapi module version 0.6 from here:
http://www.caraveo.com/fastcgi/

My redirects (setting the header Location) were not working on Safari when using https.

I looked at the headers from the page with wget and here is an excerpt of what I see:
 1 HTTP/1.1 302 Moved
 2 Server: Microsoft-IIS/5.0
 3 Date: Tue, 19 Aug 2003 22:05:29 GMT
 4 (null)
 5 Content-type: text/html
 6 X-Powered-By: PHP/4.3.2
 7 Location: http://ecomdev.mos.org/?action=showorder

Note that (null) line. What is that? An extra line feed or carriage return?

I did not see the (null) line when running under ISAPI, but ISAPI is not an option right now.

I made that mysterious (null) line go away, thus solving the Safari issue, by setting this in php.ini:
cgi.rfc2616_headers = 0

I had it set to 1 originally.

So there you have it. Something is up.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 11:01:32 2024 UTC