Problem with session_start

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I get a warning and cannot start a session.  I understand from reading
through the documentation and other posts that session_start must occur in
the php script  before any HTML tags or output to the browser.  In my
script, the session_name and session_start are the first two  lines in
thescript; so I can't see what the problem could be.

I have used sessions on other pages in a similar fashion (in the same web
project, on the same server)  and do not have any problems.

I would greatly appreciate if anyone has any ideas of what could be causing
the problem.

The warning as reported by the web server is as follows:
Warning: Cannot send session cookie - headers already sent by (output
started at /home/parking2/secure_html/ControlPanel/adminCtrl.php:2) in
/home/parking2/secure_html/ControlPanel/adminCtrl.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/parking2/secure_html/ControlPanel/adminCtrl.php:2) in
/home/parking2/secure_html/ControlPanel/adminCtrl.php on line 4

// The first lines of my php script source code are as follows:


include '../vars.php';

// Get variables from forms:
if (!empty($HTTP_POST_VARS)) while(list($name, $value) =
   each($HTTP_POST_VARS)) $$name = $value;


if ($logout)
 $_SESSION['time'] = 0;

if(!($_SESSION['time'] > (time() - 3600) ))

// end php code snippet ------------------------------------------

Re: Problem with session_start

*** Ray Torres wrote/escribió (Tue, 14 Sep 2004 19:41:16 -0700):
Quoted text here. Click to load it

If session_start() is in line 4, then you have a blank line in the
beginning of the file. That counts as output.

-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions

Site Timeline