RE: [PHP] read from comport: windows vs. linux
| From: | Kim Madsen | Date: | Thu, 07 Apr 2005 08:10:47 +0000 |
| Subject: | RE: [PHP] read from comport: windows vs. linux | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212514@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Richard Lynch [mailto:ceo@l-i-e.com]
> Sent: Thursday, April 07, 2005 6:18 AM
> > [root@lager dev]# ls -al ttyS*
> > crw-rw-rw- 1 apache apache 4, 64 Apr 5 16:01 ttyS0
This is not an acceptable solution anyway, the permissions are changed on a reboot:
Crw-rw---- 1 root uucp 4, 64 Apr 7 09:56 /dev/ttyS0
instead I´ve added the apache user to the group uucp in /etc/groups
But I did check the permissions on the /dev and only root could write to that, that´s changed now.
> Just for fun...
>
> On the command line, su to 'apache' and then do cat /dev/ttyS0
Apache user has /sbin/nologin and no bash, so I used a chsh apache, added /bin/bash and had no
problem "catting" the device...
> Okay, if that works, run your PHP script from the command line, as apache.
I´m not running PHP as CGI
> Report it as a bug, I guess. http://bugs.php.net
Nah, it´s not a PHP bug, cause I can read from it when using fopen("/dev/ttyS0",
"r");
I´m on my way... think it´s now oddies with the script, that was developed on a windows platform,
you know things like fwrite($fp, "sh ssh\r\n");
> *MAYBE* you could try using http://php.net/exec (with "cat
> /dev/ttyS0")
> and see if that allows you any kind of access. Doubt it, though.
I´m using exec to set the comport speed and the likes.
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper