Jump to content

Failure reading data from /dev/tty port in PHP application


wedz

Recommended Posts

Hi all,

 

I've been trying to get some help with some linux tty access issue in a PHP in different linux areas, but so far I have been unsuccessful to find a solution, so I thought maybe some PHP gurus here might know the problem..

 

So, I have infra-red module connected to usb, that has is seen as 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"..

I checked the executing user for Apache with 'whoami', and the user (www-data) has access to dialup group (in /etc/group):

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

 

If I become user www-data (su www-data), I can read and write from the tty ok. The tty itself looks like this:

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

 

Any ideas why my application on Apache seems to always fail to 'access error' ? :confused:

 

Edit: oh and if someone wants to get points to stackoverflow, I tried there before as well: http://stackoverflow.com/questions/10645370/reading-data-from-dev-tty-port-in-php-application-fails-to-error-reading/10664569

Thanks!

Hi kicken,

 

Thanks for your reply. I'll get the exact error message, as soon as I get back home and have a moment to sit down with the system..

I'm quite new to PHP - actually this is my first time to write something for it myself.. so I might have some issues even in some basic configurations..

 

Hmm, I guess some user rights propagation thing happened...

When I was modifying my php.ini config, I thought I might need to reload Apache, but to be on the safe side I just rebooted the whole linux, and now the reading from tty went fine! 8)

 

I have been going crazy with this for weeks now... Thanks for your time anyhow! :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.