Skip to content
Advertisement

Is there a downside to session.auto_start in PHP?

I usually end up adding session_start() to the top of every page on my PHP sites (or in a header file which is in turn included on every page). I recently discovered that you can have sessions start automatically by using the following setting in php.ini:

session.auto_start = 1

What are the potential downsides (if any) of using this setting?

Advertisement

Answer

If you turn on session.auto_start then the only way to put objects
into your sessions is to load its class definition using
auto_prepend_file in which you load the class definition else you will
have to serialize() your object and unserialize() it afterwards. See.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement