Jump to content

Too many sessions!


xcandiottix

Recommended Posts

session_save_path("/home/content/q/1/w/q1w2e3r4t5y6u7/html/tmp/");
session_start();

 

I have this at the head of my index page. I'd like to count how many files are in temp to find out how many users are online. After going to my index page, i checked how many users were online via the script I wrote and it said 1. I refreshed the page and it said 2. It went as high as 10 with each refresh and then I stopped because something isn't right. I checked my temp folder and there are 10 temp files. How can one page visitor start so many unique sessions? Is there a way to prevent this? I'm using the session start command with dual purpose. One, if a user loads the page. Secondly, to check if $_SESSION['active'] exists so I know this is a registered user. How can i limit the amount of sessions started by an unknown user and efficiently count how many files are in the temp directory?

Link to comment
Share on other sites

you can look into storing your sessions in a database rather then on the server. Its especially a good idea if the site your making is going to get so heavy traffic wise and user base wise that you will eventually need to cluster servers to run the site, and storing sessions on a single server in a clustered arrangement just wont work well.

Link to comment
Share on other sites

Some reading I came across had counting session files performing at 19% faster then a database method. I don't know if this is correct information or not but it said in a multi-user situation that a file count would be preferred due to the speed factor. Have you come across anything about that? This article could have referred to an old version of php perhaps.

 

As for my sever I am using a linux grid server provided by godaddy if that makes a difference.

 

Thanks for the reply.

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.