note 9934 added to session_start

From: Date: Sat, 02 Dec 2000 18:59:18 +0000
Subject: note 9934 added to session_start
Groups: php.notes 
Request: Send a blank email to php-notes+get-8345@lists.php.net to get a copy of this message
yar@warlock.ru, see http://www.php.net/manual/function.setcookie.php for a possible explanation of your problem. According to that page, "Cookies must be sent before any other headers are sent (this is a restriction of cookies, not PHP). This requires you to place calls to this function before any <html> or <head> tags." It sounds like if you call session_start() before the head and body tags, SID will not be set because you've successfully set a cookie. But if you call session_start() later, setting the cookie will fail and PHP will fall back on SID. The recommended method is to consistently place your session_start() at the very top of the document so that it can properly interact with cookie-enabled browsers. Hope that helps... Arlo Leach www.typea.net http://www.php.net/manual/function.session-start.php

« previous php.notes (#8345) next »