RE: read from comport: windows vs. linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux