svp
Posts: 7
Joined: Thu Nov 29, 2018 11:05 am

inotify to detect file or directory modify events

Thu Sep 12, 2019 1:25 pm

Hello Everyone,

I am using python3 for my firmware program. Using Chrome browser based UI that needs to be run on HMI display. The communication between UI(made in PHP, jQuery and HTML) and firmware is done using file read write operations. My idea is to use iNotify library in php as well as in python both the side to detect any change in particular file.

In python it is implemented and working nicely.
When I am going to install iNotify for php using sudo pecl install inotify command it is giving below errors.

Code: Select all

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/inotify.so' - /usr/lib/php/20151012/inotify.so: cannot open shared object file: No such file or directory in Unknown on line 0
downloading inotify-2.0.0.tgz ...
Starting to download inotify-2.0.0.tgz (8,836 bytes)
.....done: 8,836 bytes
3 source files, building
running: phpize
sh: 1: phpize: not found
ERROR: `phpize' failed
I gone through the solutions given on https://askubuntu.com/questions/885574/ ... n-for-php7 and https://stackoverflow.com/questions/310 ... run-phpize but failed.

How can I install inotify for php and in RPi? Is there any other way to detect the change in particular file or directory?

PHP7.0 is installed in my RPi and using examples given on https://www.simplicity.be/article/watch ... ories-php/ to watch the files or directory.

Any help or suggestion will be highly appreciated...:)

User avatar
neilgl
Posts: 764
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: inotify to detect file or directory modify events

Mon Sep 16, 2019 6:47 pm

Any reason why you have to use file change detection and not something a lot simpler?
e..g UI sets a GPIO high. A python3 program on the pi waits for GPIO to go high, then does something e.g. read a file...

Return to “Python”