Jump to content

Database vs Session - opinions please?


chigley

Recommended Posts

The argument that is usually used as a reason to not use the standard file handler is because on a shared server all the session data files of the accounts are stored in one place (a security issue) and the shortest garbage collection maxlife time of any script will delete your session data files.

 

Both of these problems can be solved by setting the session save path to be a "private" folder within your account space. A private folder is either one outside of your web document root folder or if that is not an option, a folder within your document root but is protected from any browser/http access using a .htaccess file.

 

Also, by setting your own session save handler for a database, that uses parsed/tokenized/interpreted php code, instead of using php's built-in file handler, that uses complied C code, your session operations will take about 20 times the amount of time that the file handler takes (plus the additional time for the database queries over just the file system operations). This is important when you are getting 100's and 1000's of hits per second on a site.

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.