php 的 inotify 扩展提供了监控文件或目录变化的功能,可以用来实现,服务的热更新,或安全监控。
具体使用方法参考文档:https://www.php.net/manual/zh/ref.inotify.php](https://www.php.net/manual/zh/ref.inotify.php)
下面介绍 inotify 扩展编译安装步骤:
访问 http://pecl.php.net/package/inotify 根据你php的版本号下载对应的扩展包
下载完成后解压
进入目录
编译完毕后会生成一个 inotify.so
文件
之后重启 php-fpm
对于如何基于 inotify 扩展实现服务的热更新可参考文档:https://github.com/walkor/workerman-filemonitor-inotify/blob/master/Applications/FileMonitor/start.php
[1]
http://pecl.php.net/package/inotify: https://pecl.php.net/package/inotify[2]
https://github.com/walkor/workerman-filemonitor-inotify/blob/master/Applications/FileMonitor/start.php: https://github.com/walkor/workerman-filemonitor-inotify/blob/master/Applications/FileMonitor/start.php