Ajax,Requests,and,PHP,Sessions computer Ajax Requests and PHP Sessions Solution
----------------------------------------------------------Permission is granted for the below article to forward,reprint, distribute, use for ezine, newsletter, website,offer as free bonus or part of a product for sale as longas no changes a Gone are those times when the companies and the organisations didn't need a hi-tech system to handle them. Owing to the considerable increase in the business sector and thus, an enormous increase in the complexity of the organisational struc
Ajaxian Thread "Trouble with Asynchronous Ajax Requests and PHP Sessions", community member Andy, says:"Concurrency issues have long since been solved, if you actually use the recommended methods of avoiding them. Any modern book on threading will give you the basics. With PHP it is especially problematic because each session variable is just an array index, and the entire session gets read or written at once, you can not access (or lock) just a single session variable. But this is hardly a PHP only or AJAX only problem. You would have the same kinds of issues with any series of multiple concurrent requests for the same page (like downloading images on the page that are dynamically generated based on session data).The main issue here is that there are no built-in concurrency controls across multiple requests in popular server-side programming/scripting languages, so youd have to roll your own. Things like atomic increment in memcached or get_lock/release_lock in mysql can help. One may have to forgo using PHPs session handling to get finer grained locks, which means rolling your own session variable storage engine also."where I realize "rolling my own session variable storage engine" is exactly what I need. I looked up for a MySQL session storage engine to replace php default sessions handling system, since I was too lazy to code one myself, and I found a class at phpclasses.org called "MySQL Session" that serves the purpose.I've tested the class and it works perfectly fine, thanks to the french coder Julien Pachet. I hope more people will find this useful.
Ajax,Requests,and,PHP,Sessions