4

I'm trying to get Inotify working on PHP7. I've installed the required packages:

sudo apt install php php-dev

And installed Inotify with Pecl:

sudo pecl install inotify

But it doesn't work:

$ php -r "var_dump(function_exists('inotify_init'));"
bool(false)

1 Answers1

7

Pecl installs inotify to /usr/lib/php/20151012/inotify.so and this isn't loaded by any default php.ini. So it needs to be added, by creating /etc/php/7.0/mods-available/inotify.ini with the following contents:

extension=inotify.so

And then running sudo phpenmod inotify

Now it works:

$ php -r "var_dump(function_exists('inotify_init'));"
bool(true)