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

By

January 15, 2008PHP10 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();

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
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?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • 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.

      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  2. Sandeep

    Thank you very much… yeah its working fine for me

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  3. Rey

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

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  4. levi

    thanks, man.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  5. olamide

    thank you…it worked…

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  6. Pritam Soni

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

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  7. Hadrian Sabino

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

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  8. raul

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

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  9. Em

    Thanks man, this work on my site

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.