1

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.

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.

I want to put watch on /var/www/html/js directory. There might be 8 or 9 files in that directory and need to keep watch on 3 files only.

Any help or suggestion will be highly appreciated.

fw08
  • 124
  • 9
  • 1
    And you've installed `php-dev`? You should also not add the .so-file until you've built the inotify-library. Now it looks like it's trying to load the library before it's even built. – M. Eriksson Sep 12 '19 at 13:48
  • I configured LAMP in my RPi and in that installed php using "sudo apt-get install php libapache2-mod-php -y". Is php-dev is something different from that? because I am firmware developer and I don't have enough expertise in php. – fw08 Sep 14 '19 at 05:41
  • 1
    _"Is php-dev is something different from that?"_ - Yes. You need to install `php-dev` as well (which installs `phpize`). Do `sudo apt install php-dev` and then, when that's done, try installing inotify again. – M. Eriksson Sep 14 '19 at 12:13
  • Thanks Magnus. I updated and upgraded OS and Installed php-dev. Reconfigured everything without any error. Still some issues there. When I running file in php it is always giving "500 Internal Server Error" and even not printing the echo statement. What is wrong here? I posted the code below. – fw08 Sep 20 '19 at 09:44
  • A 500 error could be anything. Make sure you have error reporting and display errors turned on while you develop. Check [this post out to learn how](https://stackoverflow.com/questions/5438060/showing-all-errors-and-warnings). Then you should see some error message instead of the generic 500 error page. – M. Eriksson Sep 20 '19 at 10:54
  • Also, never post additional code as an answer. Answer are for solutions. If you have more/other questions (like the 500 error), you should post it as a new question instead. One question per post. – M. Eriksson Sep 20 '19 at 10:58
  • Though I am new user I didn't found where to post some code if want to edit later. It was my mistake. I'll correct it. Thanks again. – fw08 Sep 24 '19 at 15:26

0 Answers0