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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.