note 84409 deleted from function.session-start by danbrown

From: Date: Mon, 14 Jul 2008 14:14:47 +0000
Subject: note 84409 deleted from function.session-start by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141488@lists.php.net to get a copy of this message
Note Submitter: Contribution User Reason: in docs ---- That's a basic, but i didn't see it here. So, for those who get the following message: Message : Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by You must avoid any characters to the output browser. Even a blank space can cause this warning and block you cookies to bet set ! For example, this code will not work ! <?php require_once('database.cls.php'); require_once('user.cls.php'); ?> <?php session_start(); ?> (because it contain a blank (space or CRLF) between "?>" and the following "<?php ?>" ) . Write instead : <?php require_once('database.cls.php'); require_once('user.cls.php'); session_start(); ?> So, careful also when you integrate your classes, with require() or include(). They must have no blank character after the end of the file. So don't let anything after the last "?>" in the class, or included file. Hope i was clear enough with my explanations ;-)

« previous php.notes (#141488) next »