Page 1 of 1
Problems with session_start()
Posted: Tue Aug 03, 2010 1:19 pm
by delpi767
when my script executtes, I receive the following warning message
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /mirror/villagesconnection/residents/login.php:1) in /mirror/villagesconnection/residents/login.php on line 2
Here's the code in its entirety...
Code: Select all
<?php
session_start();
$_SESSION['loggedin'] = "FALSE";
if ($_COOKIE['vid'])
$vid = $_COOKIE['vid'];
else
$vid = "";
if ($_COOKIE['pwd'])
$pwd = $_COOKIE['pwd'];
else
$pwd = "";
?>
What am I missing?
Thanks, Mac
Re: Problems with session_start()
Posted: Tue Aug 03, 2010 1:31 pm
by AbraCadaver
There is something output before session_start(), either some HTML or a blank line or even a space. If that is all of your code and you're not including that file from another, then there's got to be a space or blank line or something before the <?php.
Re: Problems with session_start()
Posted: Wed Aug 04, 2010 11:41 am
by delpi767
Shawn,
Thanks very much for your response. Unfortunately, what you suggest does not seem to be the case.
I have checked, double checked, and even copied these two line from other scripts which work just fine
There are no spaces prior to <? and there is exactly one space between the php and session_start.
I have removed and re-inserted that space on the off chance that it could have represented some non-printing character.
I do agree that something is trying to send header information but I cant imagine what it could be.
Thanks,
Mac
Re: Problems with session_start()
Posted: Wed Aug 04, 2010 12:34 pm
by AbraCadaver
If you are saving the file in UTF-8 format, then your editor may be saving a BOM (byte order mark) at the start of the file. Either change encoding or see if your editor has a setting to not include the BOM.
Re: Problems with session_start()
Posted: Wed Aug 04, 2010 2:21 pm
by delpi767
Thanks,
Expression Web 4 was indeed saving the fle with a byte order mark. All is now okay.
How that one file all of a sudden was saved in that format and the others weren't I have no clue, it had been working just file until I made some innocuous change yesterday
I've been using Dreamweaver for years and decided to try Expression. So far, I find Dreamweaver vastly superior but I'll keep plugging with Expression to give it a fair shake.
Mac