flock is a standard PHP function (as far as I can tell) so you don't need to "install" it. You should just be able to use it.
Be aware though, that this will NOT work on every platform (doesn't work on FAT - win95/98) so whether this works depends on the platform you are running on.
Your best bet is to go read the manual on this at http://www.php.net/manual/en/function.flock.php.
Have fun 🙂