|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-26 01:16 UTC] sanya at mail dot ru
It seem that header() function doesn`t work. I`ve tested this in simle script with few lines of code (server-side redirection). PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 03:00:01 2025 UTC |
<?php header("Location: http://localhost/"); ?> WinXP/Apache1.3.22/Apache module/Standard setup, standard modules On MSIE 6.0 and Netscape 6 nothings happen. Script start and normal end without any error (error_reporting = E_ALL). But I'm still on testing page. It seems just don't work and without any errors. I check configuration hundred times but with nothing :(I have experienced this same bug on my systems. I upgraded from PHP 4.1.2 on W2k Professional running Apache 1.3.20 to PHP 4.2.0. header() function seems to stop working. <? header("Location: http://www.queenstown.com"); ?> In any browser, no workie, workie, just blank page. Downgrade to PHP 4.2.1 and the problem disappears. A search of bug database on version 4.2.0 on all issues and all status' returns 244 results as of May 1, 2002 and this is the only mention of header() not working.I have experienced this problem also with a very simple script: if($_GET['test']) { header('Location: http://www.amigadev.net/forums/'); error_log("redirecting to forums"); // temp fix for broken PHP 4.2 echo '<HTML><head>'; echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://www.amigadev.net/forums/">'; echo '</head><body></body></HTML>'; // exit(); // die();Oops. Pardon the above accidental comment submission. I have experienced this problem which causes the PHP to not complete the request. It appears that the culprit is the exit() construct. It also occurs with the die() function. If you remove the exit(); call, the script does not error. if($_GET['test']) { header('Location: http://www.host.dom/otherdir/"); exit(); } else { echo 'ok..'; } f you call the above script as script.php?test=1 with a valid URL for redirect, you will see this error manifest itself. (Confirmed under FreeBSD 4.2)PHP 4.2 with Apache 2.035 on Win2k Professional SP2 After upgrading to V4.2 I immediately had problems with the header() function. Even a simple script: <?php header("Location: index.php"); ?> does not work. Blank page.I am experiencing the same problem with 4.2.1 on Win2000. The following code works fine with 4.1.2 but does not redirect in 4.2.1. ... if (isset($HTTP_POST_VARS["submit_login"])) { $tbp = new Users(); $tbp->retrieveDb( "where user_id = '" .$HTTP_POST_VARS["fuser_id"]. "' and password='" .$HTTP_POST_VARS["fpassword"]. "'" ); $uid = $tbp->getField("user_id"); if (!$uid) { $login_success = false; } else { $path = str_replace ("reg_login","reg_type",$PHP_SELF); $tbp->log("Directing to Location: http://" .$SERVER_NAME. $path); header ("Location: http://" .$SERVER_NAME. $path); } } .... Looking at my log the Location path is correct. I have even tried surrounding this code by ob_start() and ob_end_flush() with no luck. There is a reference in the header documnentation page indecating that referencing all variable with a @ will fix this problem. But that just seems wrong. Any workaround would be greatly appreciated.