Reputation: 105
I need something like a session-id. I will need to track a couple of thousand users visiting a website. For load-balancing (multiple instances of PHP and NGINX) I will unfortunately not be able to use session_start() and capture the sessionid because it needs to span across multiple webservers.
These users are not logged in, so I will not know anything about them, except for their browser, ip and plugins.
I was thinking maybe using APC, and do something like apc_store('count', 1);
And give the current user the id = 1.
The next user will get apc_fetch('count')+1, but I think that will be very slow, and probably also contain race-conditions.
Upvotes: 1
Views: 475
Reputation: 401172
To solve the problem of "multiple servers" with sessions, you could store your sessions in something else than the file system.
For example, you could :
A couple of interesting links :
session_set_save_handler()
Upvotes: 3