Jump to content

session_start() questions


flyhoney

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/62538-session_start-questions/
Share on other sites

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 )

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.