正文:
php
的 inotify
扩展提供了监控文件或目录变化的功能,可以用来实现服务的热更新或安全监控。
具体使用方法请参考[官方文档](https
://www
.php
.net
/manual
/zh
/ref
.inotify
.php
)。
以下是 inotify
扩展的编译安装步骤:
1. 下载 inotify
扩展
访问 [http
://pecl
.php
.net
/package
/inotify
](http
://pecl
.php
.net
/package
/inotify
) 根据你的 PHP
版本下载相应的扩展包。
2、解压
下载完成后解压
tar
-zxvf
inotify
-3.0.0.tgz
进入目录
cd
inotify
-3.0.0
3、安装
/usr
/local
/php
/bin
/phpize
./configure
--with
-php
-config
=/usr
/local
/php
/bin
/php
-config
--enable
-inotify
make
sudo
make
install
编译完毕后会生成一个 inotify
.so
文件
4、修改 php
.ini
sudo
su
echo
"extension
=inotify
.so
" >> /usr
/local
/php
/etc
/php
.ini
之后重启 php
-fpm
5、验证 inotify
安装完成
php
-m
| grep
inotify
对于如何基于
inotify
扩展实现服务的热更新可参考文档:https
://github
.com
/walkor
/workerman
-filemonitor
-inotify
/blob
/master
/Appli
cat
ions
/FileMonitor
/start
.php
转载请注明:汇站网 » 如何编译安装 inotify
扩展