LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   php "system"-call to access tty port, "error accessing" (https://www.linuxquestions.org/questions/linux-software-2/php-system-call-to-access-tty-port-error-accessing-943067/)

wedz 05-03-2012 05:34 AM

php "system"-call to access tty port, "error accessing"
 
I have IR module in connected to a tty port, and I'm trying to run an 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.

The user (www-data) has access to dialup group (in /etc/group), and if I switch over to www-data user, I am able to successfully run the program from the same folder where it resides (same folder with PHP script).
I checked the user who runs the PHP script by system call from PHP to 'whoami' and print it on screen, this is correct, right ?

I'm out of ideas, why Apache can't seem to access the port.
The program starts ok, and I get some proper output, but once trying to access the serial port, something goes awry..

Thanks for all the hints!

Tinkster 05-03-2012 04:02 PM

And what are the perms on the ports?
ls -l /dev/tty (or where ever they are in your distro)?

wedz 05-05-2012 06:46 AM

Quote:

Originally Posted by Tinkster (Post 4669715)
And what are the perms on the ports?
ls -l /dev/tty (or where ever they are in your distro)?

Code:

crw-rw---- 1 root dialout 166, 0 2012-05-03 19:10 ttyACM0
I'm running ubuntu (on arm, but I guess that doesnt matter).
To /etc/groups I have added:

Code:

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

The thing of it is, that I have changed to the www-data user, that apache/php uses, and I am able to read from that port as him :confused:

wedz 05-22-2012 07:34 PM

No ideas, anyone ?


All times are GMT -5. The time now is 03:26 PM.