flyhoney Posted July 30, 2007 Share Posted July 30, 2007 I'm writing an application that has an over-abundance of AJAX. I have a central script that the user interacts with, and several scripts are called via AJAX request to do various things. It seems however, that multiple scripts running at the same time cannot execute session_start(). Like, If I have one script that is running on the server, that is using sessions, and then kick off another script, the second one will not proceed until the first one is finished. I need them to run simultaneously. It appears that session_start puts some sort of mutex on the session file on the server, and locks it from multiple access. That makes sense. Am I interpreting the problem correctly and is their a way around it. I don't want to have to use plain old cookies. Quote Link to comment https://forums.phpfreaks.com/topic/62538-session_start-questions/ Share on other sites More sharing options...
phpknight Posted July 31, 2007 Share Posted July 31, 2007 You should be able to run them simultaneously or sessions would be rather useless. Is there error level set the highest possible? Are you getting any warnings/errors? Quote Link to comment https://forums.phpfreaks.com/topic/62538-session_start-questions/#findComment-311583 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 The default session handler locks the session file, so only one script can use that session at one time. You can solve this by writing your own session handler (there is a simple example in php's online documentation: http://sg2.php.net/manual/en/function.session-set-save-handler.php ) Quote Link to comment https://forums.phpfreaks.com/topic/62538-session_start-questions/#findComment-311592 Share on other sites More sharing options...
phpknight Posted July 31, 2007 Share Posted July 31, 2007 Nice point. I did not realize that. On the point about the session handler, Larry Ullman has a good example of that on pages 83-95 of Advanced PHP 5. It is not that expensive, and it is a good book as well. Quote Link to comment https://forums.phpfreaks.com/topic/62538-session_start-questions/#findComment-311699 Share on other sites More sharing options...
flyhoney Posted July 31, 2007 Author Share Posted July 31, 2007 Thanks a lot, I had forgotten about my forum post and didn't think anyone would be able to help me. You're wonderful people. Quote Link to comment https://forums.phpfreaks.com/topic/62538-session_start-questions/#findComment-311944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.