Author Topic: header("Location: $COMM_PATH"); on Windows Doesn't Work Right  (Read 2049 times)

Offline cgountanis

  • Newbie
  • *
  • Posts: 8
Why does header("Location: $COMM_PATH"); not work right on Windows. Same issue with squirrelmail. You can to replace the redirect to a mete refresh other wise you login no warning and start over at login screen. Any ideas?


Change this in index.php
Code: [Select]
header("Location: $COMM_PATH");
to:
Code: [Select]
echo "Enter";

Offline cgountanis

  • Newbie
  • *
  • Posts: 8
Re: header("Location: $COMM_PATH"); on Windows Doesn't Work Right
« Reply #1 on: June 03, 2007, 11:09:47 PM »
I think I found my own answer. Using IIS 5 and php-cgi.exe as PHP handler is problem in IIS 5.

setcookie + header Location + IIS 5 = Trouble

It took me a long time to figure out what was causing a missing cookie in one system while it worked perfectly in another...

See this one: http://support.microsoft.com/kb/q176113/

In short, this WILL NEVER WORK IN IIS 5:
header("Pragma: no-cache");
header('Location: http://www.example.com/');
setcookie('AA','1',0,'/');
setcookie('BB','2',time() + 24 * 3600,'/');
?>

You will ONLY get the Location Header, everything else will be "cut out" by IIS 5 CGI implementation.

Solutions:
1- Migrate to Apache/IIS6/Whatever
2- Use a Non Parsed Header Script (nph-*.php)
3- Try with header('Refresh: 0; $URL');