RE: [PHP] read from comport: windows vs. linux
| From: | Jay Blanchard | Date: | Tue, 05 Apr 2005 13:42:23 +0000 |
| Subject: | RE: [PHP] read from comport: windows vs. linux | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212258@lists.php.net to get a copy of this message | ||
[snip]
I´ve got a problem porting from windows to Linux, when I wanna read and write to the serial port.
This works like a charm in windows:
if (!$fp = fopen("COM1", 'w+b')) {
echo "\nError! Could not open COMport - Got a terminal open?\n";
exit;
}
The program continues, but breaks in linux:
if (!$fp = fopen("/dev/ttyS0", 'w+b')) {
echo "\nError! Could not open COMport - Got a terminal open?\n";
exit;
}
I´ve checked and made sure that there´s a device on /dev/ttyS0 with minicom, where I´ve got no
problem accessing the device. But I keep getting this error:
Warning: fopen(/dev/ttyS0): failed to open stream: Permission denied in /var/www/html/s.php on line
85
Line 85 is the fopen line.
Permissions are:
crw-rw-rw- 1 root uucp 4, 64 Apr 5 13:38 /dev/ttyS0
having apache be the groupowner doesn´t change anything
[/snip]
You may also need to change the user/owner, depending on what Apache is running as.