Re: headers already sent.
| From: | Stephen Lake | Date: | Sat, 08 Apr 2006 20:37:10 +0000 |
| Subject: | Re: headers already sent. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233582@lists.php.net to get a copy of this message | ||
There is no real way of knowing if output is going to be sent before a
header or not, unless its a very simple page.
Your best bet is to investigate the output buffering functions here:
http://www.php.net/manual/en/ref.outcontrol.php
HTH
Steve
""P. Guethlein"" <peterg@deltronix.com> wrote in message
news:7.0.1.0.2.20060408005425.035d6a68@deltronix.com...
> At 10:30 PM 04/07/2006, you wrote:
>>Comment inline:
>
> Thanks, I just found that out after, well I don't want to say how long it
> took <smile>.
>
> Is that just the way things are in PHP or is there a command /
> configuration to make something like this more obvious? Hmmm..... maybe
> the IDE I'm using? Using EnginSite. Is there a better one for a Windows
> Environment ?
>
> ( head banging against wall )
>
> -Pete
>
>
>
>
>>P. Guethlein wrote:
>>>(Know enough to be dangerous beginner...)
>>>
>>>Routine for a web login asked user name and password.
>>>
>>>User Name is entered correctly.
>>>
>>>Password is Incorrect.
>>>
>>>Next Try.
>>>
>>>User Name is enter correctly.
>>>
>>>Password is Entered Correctly.
>>>
>>>PHP notifies me on the html output that I am logged in. However, an
>>>error is appearing in text above the html output. It states
>>>
>>>Warning: Cannot modify header information - headers already sent by
>>>(output started at D:\webpages\XXXX\users.inc:11) in
>>>D:\webpages\XXXX\web\loginfunctions.php on line 26
>>>
>>>Users.inc is
>>>
>>>==============
>>><?php
>>>$domain = 'localhost';
>>>$admin = 'xxxxx';
>>>$user = 'xxxxx';
>>>$web = 'xxxxx';
>>>$password = 'xxxxxx';
>>>$site = 'xxxxx';
>>>$leads = 'xxxxx';
>>>?>
>>This gap right here, it's outputting a carriage return and/or linefeed.
>>headers get sent on the first character of output being sent.
>>><?php
>>>// Configuration settings for My Site
>>>
>>>// Email Settings
>>>$mailsite['from_name'] = 'xxxxx Website'; // from email name
>>>$mailsite['from_email'] = 'webserver@xxxxxx'; // from email address
>>>
>>>// Just in case we need to relay to a different server,
>>>// provide an option to use external mail server.
>>>$mailsite['smtp_mode'] = 'enabled'; // enabled or disabled
>>>$mailsite['smtp_host'] = 'mail.xxxx.xxx;mail.xxxxx2.xxx';
>>>$mailsite['smtp_port'] = '25';
>>>$mailsite['smtp_username'] = null;
>>>?>
>>>===================
>>>
>>>Line 26 from the loginfunctions.php file is
>>>
>>>//now redirect the user to whatever page they wanted.
>>>header('Location: index.php?href='.$link);
>>>
>>>==================
>>>
>>>I can anticipate what the problem is with the notification that PHP gives
>>>me with the headers already output. However, it says 'headers already
>>>sent by users.inc', huh?
>>>
>>>Suggestions of where to look on this bug is appreciated!
>>>
>>>-Pete
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php