0

I have a light sensor that uses I2C for data transmision. Now I want to display that data on a Website.

The problem is www-data can't access I2C. I use a Python script that gets run by PHP (I know it's not the best idea) and it throws

ERROR: "PermissionError: [Errno 13] Permission denied"

I tried giving the script 777 and gave the file to www-data. Nothing changed.

What can I do?

AdminBee
  • 21,637
  • 21
  • 47
  • 71
Bhasim
  • 1
  • what mechanism does your python script use to access i2c? – Marcus Müller Mar 06 '23 at 14:15
  • I use smbus, but the python script isn't the problem shouldn't – Bhasim Mar 06 '23 at 14:35
  • Without knowing knowing the specifics of what you are doing on what locations, it seems like you need to be able to give permission to the `i2c` bus for the apache user `www-data`. If you haven't already attempted something like this you might check out: https://lexruee.ch/setting-i2c-permissions-for-non-root-users.html – Csnap Mar 06 '23 at 18:04

0 Answers0