On 9 Feb 2013, at 21:00, Jonathan Eagle <jeo...@attglobal.net> wrote:

> Stuart,
> Thanks for getting back to me....  you were right - I had misread the
> headers_sent() Return Value statement.  When I went back and tested
> it turns out that the 'initialize' routine is somehow prematurely
> sending output out.   So, now I have to figure out which of the ten
> called routines and classes/objects in the initialize script are the
> culprit.
> I greatly appreciate the assistance,

The error message that should be being displayed tells you where output was 
started. Check your error_reporting and display_errors settings to make sure 
errors are being displayed and you should be able to save a lot of time.


Stuart Dallas
3ft9 Ltd

> On 2/9/2013 2:34 PM, Stuart Dallas wrote:
>> On 9 Feb 2013, at 19:00, Jonathan Eagle <jeo...@attglobal.net> 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&1.com 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).
>>> 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:
>>>     ["HTTP_CACHE_CONTROL"]=> "max-age=0"
>>> It doesn't look relevant to me, but I include it to be thorough.
>>> I looked through the PHP changelog pages, but I don't see mention of the
>>> problem (of course, that might just be due to my ignorance).  The ISP
>>> for the production version of PHP indicated that I should come here for
>>> help, so here I am.
>>> Can anyone shed some light as to what is (or might be) going on?
>>> Any help or guidance that can be offered will be greatly appreciated.
>> Check the output buffering settings. You say no errors are displayed, but 
>> are you sure that errors are set to be displayed?
>> You mention the headers_sent() result immediately after the header() 
>> function call is true. If the header() function call had worked it would not 
>> be true, it would be false. You have output being sent to the client before 
>> that header() function call.
>> -Stuart
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to