session_start() issue...

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

Threaded View
Hi all,

I have a strange issue with the session_start() function...

the following code give me an error:

<?php session_start();

    include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/
    $securimage = new Securimage();

    if ($securimage->check($_POST['captcha_code']) == false) {
  die('The code you entered was incorrect.  Go back and try again.');

and I get the following error:

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at /u/q/qbt/verify1.php:1) in /u/q/qbt/
verify1.php on line 1

I know that session_start should be at the very top... but it doesn't

any suggestion???



Re: session_start() issue...

Vit wrote:
Quoted text here. Click to load it

Doesn't have to be. But it must be before any session data is accessed AND
it must be before *any* output is produced.

Yes. At the very top
Quoted text here. Click to load it

Check for anything before your <?php, even a blank line. That is what the
message means. It can't send the session cookie header because there have
already been headers sent, and that happens automatically when you send
anything at all, even a blank line, to the browser. It even tells you where,
in verify1.php on line 1. The blank line before <?php :-)


Re: session_start() issue...

Quoted text here. Click to load it

solve it.... it was the encoding of the file... UTF-8... I have change
it to ANSI and it works!!!

anyone has any suggestion???



Re: session_start() issue...

Vit escribió:
Quoted text here. Click to load it

PHP doesn't handle UTF-8 files properly when it has a byte order marker
(BOM), also known as signature: it treats the BOM as if it was a regular
char. Many editors have the option to save UTF-8 without signature,
which could be a fix if you do need Unicode.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Site Timeline