AndrewM16921 Posted July 18, 2013 Share Posted July 18, 2013 So I was wondering if there is a way to create a server-like behavior with php. That is to say, a sort of "static" variable set that can be accessed and shared between all php sessions. And if this is possible, how would I go about setting it up? Thanks Link to comment Share on other sites More sharing options...
birbal Posted July 18, 2013 Share Posted July 18, 2013 There is many way to persist data. You can use database,flat files. there is APC,memcached like extension which can store data in memory to share data between request. which one will be better is depend upon what you need to do actually. Link to comment Share on other sites More sharing options...
AndrewM16921 Posted July 18, 2013 Author Share Posted July 18, 2013 I just wanted to create a sort of "active in last 15 min" list of my users. Seemed kind of weird to use a db for that. I'll have to look into this apc thing. o.O Thanks Link to comment Share on other sites More sharing options...
birbal Posted July 18, 2013 Share Posted July 18, 2013 You can store session data in database where there will be timestamp of last time update. after that getting last 15 minute would be trivial sql query. Check http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCsQFjAA&url=http%3A%2F%2Fphp.net%2Fmanual%2Fen%2Fclass.sessionhandlerinterface.php&ei=jd_nUfSjAcW8rAfjv4FI&usg=AFQjCNFC98sy68egSNGfVuZkaDRxQ3G6mA&bvm=bv.49478099,d.bmk . APC would not be necessary for this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now