I'm working through exactly the same issue as described by skaap2k. (11/04/07 12:01 AM, ID: 22503690)
I am using a Linux (Ubuntu) server and PHP as a web server. The solution offered appears to be for a command line version of PHP, and doesn't work in my web server.
In short, I need to read and write to a GSM modem via the serial port using php. Writing is working fine.
Reading using fread() of /dev/ttyS1 stalls the server until the required number of bytes set in fread() and a CR is received.
I need to return from checking the serial port with a null if there is no new data. I'm happy to pick a byte at a time from the serial buffer and assemble it into a string in php.
Any suggestions welcome!