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!

Link to comment
Share on other sites

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..

 

Link to comment
Share on other sites

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! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.