I have a localhost website that calls a peripheral device through /dev/ttyACM0. This was working fine until I upgraded ubuntu and firefox. Now I get port error: port not found. I use a compiled C program to call the peripheral device and pass variables. It still works fine from the command line and also if I embed within a php program and call that program from the terminal. However, if I call that through firefox browser as in localhost/program.php this no longer works. I think I have firefox 113 now. I believe based on the behavior this is not a problem with php or ubuntu but is specific to firefox. I've tried to change permissions but no luck. don't see any documentation specific to this issue. Let me know if you know the solution or can suggest things to try.
Your PHP script runs on a webserver (probably apache?) and this server has it's own user ID (i think it's www-data
on Ubuntu). You can find that user ID with this tiny PHP script. That you should call through the browser, not run directly on the command line.
<?php
system('whoami');
This user probably doesn't have permissions to access /dev/ttyACM0
. On Ubuntu, this permission can be granted by adding that user to the dialout
group.
$ sudo adduser XXXXXX dialout
Where XXXXXX is the username you got out of the PHP script above.
You'll need to restart the webserver for this to take effect... might be easiest to reboot.