如何在PHP7.4中使用inotify

问题描述 投票:1回答:1

我在PHP 7.3.x上使用PECL扩展名inotify,没有任何问题。我更新到PHP 7.4,但未成功获得为构建inotify编译的20190902扩展名,因为PECL命令sudo pecl upgrade inotify表示存在

无升级

那么我如何获得此扩展名?

inotify php-7.4
1个回答
1
投票

我通过从源代码编译得到它的工作。您可以下载最新版本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,等等。>

© www.soinside.com 2019 - 2024. All rights reserved.