我在PHP 7.3.x上使用PECL扩展名inotify
,没有任何问题。我更新到PHP 7.4,但未成功获得为构建inotify
编译的20190902
扩展名,因为PECL命令sudo pecl upgrade inotify
表示存在
无升级
那么我如何获得此扩展名?
我通过从源代码编译得到它的工作。您可以下载最新版本here(应该是>=2.0.0
我相信)。
解压缩下载的.tgz
,进入解压缩的文件夹,然后继续执行以下命令:
phpize7.4 # this is the important command
./configure
make clean
make
make install
将使用20190902
编译库并将其安装在/usr/lib/php/20190902
中:
$ ls /usr/lib/php/20190902/ | grep inotify
inotify.so
我相信您知道如何启用该扩展;但是如果不这样做,首先需要在/etc/php/7.4/mods-available
中创建一个名为inotify.ini
的文件,其内容如下:extension=inotify.so
以引用该mod。所以看起来像这样:
$ cat /etc/php/7.4/mods-available/inotify.ini
extension=inotify.so
然后您可以仅在版本7.4:phpenmod -v 7.4 -s ALL inotify
中为每个SAPI启用mod。然后可能重置php7.4-fpm
,等等。>