General discussion

Locked

Linux,Apache,PHP and Serial Comm.

By bichelmo ·
We are trying to do a write and read function using PHP DIO_ function. It works great from Command line, but can't get to work while running through apache. It keeps giving /dev/ttyS0 Permission denied. Any help would be appreciated.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by cpfeiffe In reply to Linux,Apache,PHP and Seri ...

What user are you on the command line? Check perms on /dev/ttyS0. What user is Apache running as? I suspect it will be nobody or www or something like that. That is probably not the user you are running from on the command line. The user that owns the Apache process probably does not have rights to the device file. There are many combinations of ways to resolve this such as
1) modify permissions, owners, group on the device file
2) modify the Apache config to have it start as a different user and/or group
3) some combination thereof.

Be careful of your security requirements as you make these changes though.

Collapse -

by bichelmo In reply to

Already tried this suggestion. Thanks for the reply.

Collapse -

by bichelmo In reply to Linux,Apache,PHP and Seri ...

I guess that I should have detailed better what we have already tried.
1. We modified apache conf. to launch as user web.
2. We modified owner of ttyS0 to be web.
3. We opened permissions of ttyS0 to wide open.
4. We su - to user web and it works fine.

Collapse -

Serial port question

by boonboy28 In reply to Linux,Apache,PHP and Seri ...

How do I read a serial port value using php. I have tried using fopen and fread and fgets but my web page just freezes, have you any idea what this could be.

Back to Linux Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums