Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect file change in PHP without polling

I'm trying to detect when a particular file is modified without polling the contents of the file looking for changes.

The server runs Mac OS X, so inotify is not available. My server allows for the use of exec().

How can I achieve this?

like image 856
Sosumi Avatar asked Nov 20 '25 13:11

Sosumi


1 Answers

Check the filemtime(). You can poll it every so often and it's much easier than looking for changes in the file itself.

like image 68
Niet the Dark Absol Avatar answered Nov 23 '25 03:11

Niet the Dark Absol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!