Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002

    php persistant flock()ing ?

    Hello, is it possible to flock() a file, and keep the lock on the file even after the script terminates?

  2. #2
    Join Date
    Jun 2002
    Unfortunatly, not in an easy mannor.

    PHP automagicly releases the lock when the script ends so your only option would be to edit the PHP source code to stop it doing this and compile your own custom version of PHP.

    Even that might not work though, I'm afraid I don't know enough about file locking to say for sure.


  3. #3
    Join Date
    Mar 2002
    New York
    Why not do it server side using shell_exec() in PHP? Create a bash script to lock the file, and unlock the file.

    Run the script via PHP

    $exec = shell_exec("");

    After the script is executed, it will still be locked. then later, just unlock it with another bash script.

  4. #4
    Join Date
    Nov 2002
    thats exactly what i will do. i was thinking in C, but now that u mention it. excellent!

    btw, can i get php to wait for a lock with flock()? i havent used it before..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts