Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: session.auto_start

Tags:

php

session

I have two projects in the same server, their settings conflict in the "session.auto_start", related post. Can I have the session.auto_start "ON" despite the other project contains codes such as session_start()?

like image 654
hhh Avatar asked Sep 04 '09 10:09

hhh


3 Answers

If you're using apache, and have the right Options, you can enable session.auto_start with a .htaccess file containing this line: php_flag session.auto_start 1

Or you might be able to put it in your global apache config in that tag.

like image 103
JasonWoof Avatar answered Oct 10 '22 10:10

JasonWoof


Do you need to independent sessions per user? I imagine you could just have one script check if a session already exists, like:

if(!($_SESSION)) {
    session_start();
}
like image 39
Anthony Avatar answered Oct 10 '22 09:10

Anthony


If a session is already started. Then you will get an E_NOTICE error. session_start() docs.

like image 3
Ólafur Waage Avatar answered Oct 10 '22 10:10

Ólafur Waage