note 69418 deleted from ref.session by colder

From: Date: Tue, 05 Sep 2006 18:39:41 +0000
Subject: note 69418 deleted from ref.session by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116715@lists.php.net to get a copy of this message
Note Submitter: roan dot kattouw at home dot nl Reason: in docs ---- I've just done a lot of debugging on a session that just wouldn't start, and finally found the problem after an hour and a half: <?php require_once('config.php'); // ... session_start(); // Rest of session stuff goes here ?> config.php: <?php // config stuff goes here ?> <-- BLANK LINE That blank line was outputted to the browser. That's not a major problem, unless you call a function that only works when nothing has been outputted to the browser yet. session_start() just happens to be one of them. So: - Call session_start() first thing, preferably before any require()s or include()s. - Never add a blank line after the ?> tag, as it might give others (or yourself) this kind of headaches.

« previous php.notes (#116715) next »