Thanks for the suggestion.  Your suspicions were correct. I am now
tracking down the culprit.


On 2/9/2013 2:34 PM, Matijn Woudt wrote:
> On Sat, Feb 9, 2013 at 8:00 PM, Jonathan Eagle <> wrote:
>> I'm having a problem with a very straightforward routine; one that works
>> in one PHP installation but not on the other. The only difference that I
>> can see between the working version and the non-working version is that
>> the one that doesn't work is running on the later version of PHP. The
>> following basic log-in routine works fine on my personal development
>> server, running PHP 5.3.3, but doesn't work on the production server,
>> hosted by 1& that is running PHP 5.4.11.
>> <?php
>> require_once('../includes/initialize.php');  //<== $session object
>>                                                init'd and set to false
>> if(!$session->is_logged_in())
>> {
>>         header("Location: login.php");
>>         exit;
>> }
>> ?>
>> login.php is in the same directory as the file that has this code at the
>> very top of the file.
>> Everything works as expected right up to the 'exit;' line.
>>       * $session->is_logged_in() is false
>>       * when tested immediately after the 'header("Loc...)' statement,
>>            'headers_sent()' reports true.
>>       * no error messages result (like: 'header already sent', etc.)
>> Instead of the program flow moving to 'login.php', the URL indicates
>> that the destination is the original file, except that the file is empty
>> - zero bytes.  I've tried accessing the routine via three different
>> computers, all running different MS operating systems from XP to Win7
>> and they all behave identically.  The behavior is also consistent
>> between browsers (i.e., FireFox, Chrome, and Windows Explorer).
> It seems like the header is not actually send, maybe because the headers
> are already sent.
> You can check what your server returned with the Developer tools in Chrome,
> or Firebug in Firefox. It should have that header in its return, but I
> doubt it's there.
>> I also did a $_SERVER variable dump immediately before and after the
>> 'header(...' line, expecting to see a difference in at least one of the
>> 'REDIRECT_*' elements, but both outputs where identical with the
>> exception that the $_SERVER ouput after the header statement was
>> executed was missing the following line:
> $_SERVER refers to headers that were send from client to server, the
> redirect header you set is with the headers sent from server to client.
> I would try a file like this first:
> <?php
> header("Location: login.php");
> ?>
> and see if that works. Then you can investigate further.
> - Matijn

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to