When using file locking in php and 2 people are trying to access the file at the same time, will the first person get access and the second actually wait till the file is unlocked again or will it give an error?

    6 days later

    please i really need to know this!

      If you're running a server, have working code, and have an IP, I can help you figure that out fairly quickly.

        uh, that doesn't really answer my question. heres the thing, i am using file locking in the new version of the forum i develop (ultimate php board) and i was wondering when the forum gets really busy and stuff and the file is locked from someone else (to ppl viewing the same page at the same time.) will the person that came second wait till the file is unlocked or will it just give an error?

          You could always build your own locking mechanism much like a semaphore or a mutexed monitor by using touch, file_exists and writing to file by creating blank files to lock unwanted actions.

          While a certain file exists, the action must wait.

          This way you can use several different files to lock different actions globally through one monitor object.

          I have done so in the past and it has worked nicely.

            Write a Reply...