Been over this for the last hour, and cant really figure out whats wrong.
This is the code I was using to debug the issue.
Monitor.php
$fp = fopen("lock.txt", "r+");
$var=flock($fp, LOCK_EX | LOCK_NB);
var_dump($var);
$var=flock($fp, LOCK_SH | LOCK_NB);
var_dump($var);
exit;
locker.php
$fp = fopen("lock.txt", "r+");
sleep(60);
To see if flock is working properly, I first run the locker.php, so that file will be locked for 60 seconds, and I then try running the monitor.php to see if I can get a lock.
I get TRUE
for both exclusive and shared lock.
What would be the problem?
Solution : Assumed opening the file would lock it. The locker should issue an flock to lock the file.
Missed that part in the hurry. Deadlines.Deadlines :)