Jump to content

Is having "session_start()" on all my Pages OK


Possum

Recommended Posts

Sure, it is fine. A lot of apps will route all requests through a single .php file (known as a router) or will have a common .php file that is included at the top of every script. These common php files are where the session_start() (and other initilization type stuff) happens usually so it will happen on every request, regardless of whether the resources being initialized are actually needed for that request or not.

 

Starting a session (or connecting to a DB) is generally needed more often than not in apps that use them so it is convinent to have them initialized in a common location somewhere. The overhead of intializing them is generally small enough that it is not worth worrying about trying to skip them for a few odd pages that may not need them.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.