Notice: A session had already been started – ignoring session_start() in .. on line ..

PHP Jan 15, 2008 10 Comments

For an error like this

Notice: A session had already been started – ignoring session_start() in .. on line ..

This happens when you try to start session more than once.

The solution for above problem is

1) in php.ini file set session.autostart to 0

session.auto_start = 0

2) In your code use this line

if (!session_id()) session_start();

instead of

session_start();

Comments

10 Responses to “ Notice: A session had already been started – ignoring session_start() in .. on line .. ”
  1. mocabilly

    I was told that, to get the session started, nothing, not
    even a blanc line was allowed “before” the session_start() function call..

    Will the session still be started properly?

    • Ajay Kumar Singh

      The solution provided above is for the “Notice: A session had already been started – ignoring session_start() in .. on line ..” problem.

      A blank line above session_start() would matter. After all it is a php code and in php blank lines are allowed.

  2. Sandeep

    Thank you very much… yeah its working fine for me

  3. Rey

    Thanks, i’ts solved my problem.
    Thank you very much

  4. levi

    thanks, man.

  5. olamide

    thank you…it worked…

  6. Pritam Soni

    Thanks for the help.. worked for me after searching a lot!

  7. Hadrian Sabino

    At last, I have been looking all over until this solution here. It works!

  8. raul

    Put ob_start(); at the top of your index file or header file.

  9. Em

    Thanks man, this work on my site

Leave a Reply