RE: [PHP] calling session_start()
| From: | John W. Holmes | Date: | Sun, 29 Sep 2002 17:47:52 +0000 |
| Subject: | RE: [PHP] calling session_start() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118091@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Børge Strand [mailto:borges@ifi.uio.no]
> Sent: Sunday, September 29, 2002 1:12 PM
> To: php-general@lists.php.net
> Subject: [PHP] calling session_start()
>
>
> Hi All,
>
> When does session_start() have to be called? I have the following
> setting:
>
> A bunch of php pages are placed in a frameset. If someone tries to
> access one of these pages without the session-id cookie being set, the
> page calls a reloading of the frameset. The frameset page itself is
> the first to call session_start()
>
> Am I right to believe that session_start() has to be called before one
> can do if (!isset($_SESSION['foo']))? It is this test that determines
> whether or not to reload the frameset.
Yep.
> On my development system this works just fine, but going into
> production on a web hotel, I get a lot more warnings. Every page in
> the frameset says "Warning: Cannot send session cache limiter -
> heaaders already sent..." in response to session_start() in the test I
> described above.
What's the exact error. Session_start() has to be called before any
output. The error message tells you exactly where the output started.
It'll give you the path to some page followed by :X, where the X is the
line number of that file where the output started.
> Which setting in php.ini enables this warning?
> Do you know how I can test for the presense of a session without
> getting this error?
You can work around it by using output_buffering, but I'd just recommend
you fix your code so things are in the right order...
---John Holmes...