By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

Problem with session_start

P: n/a
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 ------------------------------------------

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
*** Ray Torres wrote/escribió (Tue, 14 Sep 2004 19:41:16 -0700):

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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.