You are here: Re: how do I fix this " Warning: session_start(): Cannot send session cache limiter" « PHP Programming Language « IT news, forums, messages
Re: how do I fix this " Warning: session_start(): Cannot send session cache limiter"

Posted by lawrence k on 06/18/06 20:21

Gordon Burditt wrote:
> >> >>> 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.

Thank you. Your advice is some of the most helpful that I've gotten.
But when I use my text editor to run a global search on all of my code,
I only find one call to session_start().



> session_register() should only be used if register_globals is on,
> which it shouldn't be, so don't use it. Use $_SESSION.

I've deleted the call to session_register(). I hope this helps.








> >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().

Oh! That is very good to know. Can I ask where you found that
information? This page:

http://us3.php.net/session_start

says "If a user uses ob_gzhandler or like with ob_start(), the order of
output handler is important for proper output. For example, user must
register ob_gzhandler before session start."

but from that it's not transparent to me that cookies must be called
before session_start(). Where is this stated as a general principle?

However, I'll now call setcookie before I call session_start(). Hope
that helps.

Thanks much for all your help

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация