Question

I have USB IR module in connected to a tty port, and I can read/write data from/to it fine.

Now I'm trying to run a PHP application that would read data from that port, but for some reason my PHP script on Apache can't seem to read the serial port. I get complaint "error accessing" The user (www-data) has access to dialup group (in /etc/group):

...
dialout:x:20:jlumme,www-data
...

And if I switch over to www-data user (su www-data), I am able to successfully run the program from the same folder where it resides (same folder with PHP script). Access rights to the tty should also be ok:

>ls -l /dev/tty
...
crw-rw---- 1 root dialout 166, 0 2012-05-03 19:10 ttyACM0
...

I'm out of ideas what to try..

Was it helpful?

Solution 2

Looks like all I had to do was to re-boot the linux board, and now it worked ok. I'm not sure what went wrong before, possibly re-starting Apache could have done the trick.

Anyhow, just making sure proper user rights have access to /dev/tty seems to be the answer!

OTHER TIPS

Try:

<?php
system('whoami');
?>

to see if the script is run as www-data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top