Locks in php
Posted: Wed Feb 09, 2005 2:36 pm
Hi all
Can anyone tell me an efficient way of implementing locks in php. I want locks to restrict database access from simultaniously running scripts. And I want a lock that I can set in one script and release later in another. With my system configuration beeing windows xp, apache and php running as an module on it, the only solution I could come up with is using files for each db-table and then use flock() to lock each of these files. However this yields bad performance as I have to access a file on each db-query...
I've tried using persistent connections against the mysql-server I'm running, but couldn't get the desired results (I'm pretty sure now that this approach is impossible to use with the current versions of mysql (4.1.19) and php (5.0.3)).
Note: The semaphore extension is not available in Windows....
regards tores
Can anyone tell me an efficient way of implementing locks in php. I want locks to restrict database access from simultaniously running scripts. And I want a lock that I can set in one script and release later in another. With my system configuration beeing windows xp, apache and php running as an module on it, the only solution I could come up with is using files for each db-table and then use flock() to lock each of these files. However this yields bad performance as I have to access a file on each db-query...
I've tried using persistent connections against the mysql-server I'm running, but couldn't get the desired results (I'm pretty sure now that this approach is impossible to use with the current versions of mysql (4.1.19) and php (5.0.3)).
Note: The semaphore extension is not available in Windows....
regards tores