Home > PHP > Notice: A session had already been started – ignoring session_start()

Notice: A session had already been started – ignoring session_start()


This problem occurs when your PHP.INI file has session.autostart turned on. You’ll need to turn this off by:

  1. Editing your PHP.INI file and setting it to off — or contacting your web hosting provider to do this for you
  2. Placing a .htaccess file in the root of your web directory with the following value: php_flag session.auto_start 0
  3. If you session_start twice in your code that will rise an warning to suppress it you can use
if(!isset($_SESSION)) 
{ 
session_start(); 
}  

 

About these ads
Categories: PHP
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 596 other followers

%d bloggers like this: