Problem with php script that try to read file while Powerhell writes to it

Viewed 51

I have a big problem with a apache server running PHP. Often some PHP scripts is trying to get data from a CSV file while a Powershell script writes to it. Is there a common way to prevent this? I have tied to write to the file at a specific time and then read from the file while no writing is done. But even when I set a read error in the PHP to 20 sec. it often try to read an write at the same time.... HELP!

1 Answers

I cant add a simple comment because I dont have reputation points... Don't understand that logic but whatever. The most common way of resolving this is using a lock file to signal to another process that the file is in use, check out this little guide: locking-files-with-flock

Related