|
Posted by Gordon Burditt on 06/18/06 19:17
>> >>> session_start();
>> >>> session_register();
>> >>
>> >>You probably have a blank space or an empty line somewhere between the
>> >>beginning of a file and the first "<?"... Find it and delete it.
Unfortunately, white space and other body output isn't the only
thing that causes headers to be sent. Sending headers (e.g.
session_start()) also causes headers to be sent. If you're going
to setcookie(), setcookie() before session_start() and before any
output.
Also, don't call session_start() before session_start(). Limit:
one call per PHP hit.
session_register() should only be used if register_globals is on,
which it shouldn't be, so don't use it. Use $_SESSION.
>But as I said earlier in the thread, PHP is giving me bum messages that
>offer no illumination.
They are telling you where the problem is. White space is a common,
and difficult to find, but not the only cause of headers being sent.
>My error logs are full this one line, repeated
>over and over again:
>
>
>[18-Jun-2006 07:56:19] PHP Warning: Cannot modify header information -
>headers already sent in
>/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachineIdOnVisitorsMachine.php
>on line 26
setcookie() goes before session_start().
>[18-Jun-2006 07:56:49] PHP Warning: Cannot modify header information -
>headers already sent in
>/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachineIdOnVisitorsMachine.php
>on line 26
>[18-Jun-2006 12:26:19] PHP Warning: session_start(): Cannot send
>session cookie - headers already sent in
>/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php
>on line 14
Don't call session_start() twice.
>But this is line 14 and 15 of CommandStartSession:
>
> session_start();
> session_register();
>
>
>
>and this is line 26 of CommandSetMachineIdOnVisitorsMachine:
>
> $success = setcookie("machineId", $machineId, time() + 10000000);
Gordon L. Burditt
Navigation:
[Reply to this message]
|