PHP Classes

php serial and linux

Recommend this page to a friend!

      PHP Serial  >  All threads  >  php serial and linux  >  (Un) Subscribe thread alerts  
Subject:php serial and linux
Summary:problem with sending data when using linux
Messages:7
Author:Nina
Date:2009-03-04 09:51:03
Update:2011-04-15 07:03:38
 

  1. php serial and linux   Reply   Report abuse  
Picture of Nina Nina - 2009-03-04 09:51:03
Hello,
I have downloaded PHP serial and it works great in Windows.
I have some microcontroler device that is returning response after I send data, so I decided to test it in linux (because I can't read it with windows), but in Linux it projects warnings:

Warning: Specified port is not valid in /var/www/folder/php_serial.class.php on line 112
Warning: Unable to set the baud rate : the device is either not set or opened in /var/www/folder/php_serial.class.php on line 205
...
...
Warning: The device must be set before to be open in /var/www/folder/php_serial.class.php on line 138
Warning: Device must be opened in /var/www/folder/php_serial.class.php on line 542
Warning: Device must be opened to read it in /var/www/folder/php_serial.class.php on line 475

In example.php I changed device specification to $serial->deviceSet("/dev/ttyS0")
I'm using Ubuntu 7.10 and there is PHP version 5.2.3.-lubuntu6.5

I don't know where the problem is, because when I send data through shell to the port everything works fine (that was also the test that the port is working):
echo some_hex_data > /dev/ttyS0

Does anyone knows what am I doing wrong? Can anyone help me? :)
Beforehand thank you,
Nina

  2. Re: php serial and linux   Reply   Report abuse  
Picture of Nina Nina - 2009-03-05 14:49:00 - In reply to message 1 from Nina
problem solved :)

  3. Re: php serial and linux   Reply   Report abuse  
Picture of MOURIER MOURIER - 2009-03-05 16:52:16 - In reply to message 2 from Nina
Hello,
I get the same problem with linux, but I dont find the solution. Can you help me please
Regards
Michel

  4. Re: php serial and linux   Reply   Report abuse  
Picture of Sean Siegel Sean Siegel - 2009-03-06 04:29:20 - In reply to message 2 from Nina
Hi nina, im have the exact problem in ubuntu server. What exactly was the solution?

Thanks!

  5. Re: php serial and linux   Reply   Report abuse  
Picture of Sean Siegel Sean Siegel - 2009-03-06 23:44:16 - In reply to message 4 from Sean Siegel
Ahh it was a permissions problem. Im not sure what user php runs its scripts but i just changed the permissions on the serial port...

chmod 0777 /dev/ttyS0

  6. Re: php serial and linux   Reply   Report abuse  
Picture of MOURIER MOURIER - 2009-03-07 13:06:10 - In reply to message 5 from Sean Siegel
Hello

Few people on earth seems using this script, however its very interesting. I follow what you say, but I still get this message back:

Warning: Unable to open the device in /var/www/html/rs232/php_serial.class.php on line 175
Warning: Device must be opened to read it in /var/www/html/rs232/php_serial.class.php on line 496
Fini (That's all folks)

  7. Re: php serial and linux   Reply   Report abuse  
Picture of arjun arjun - 2011-04-15 07:03:38 - In reply to message 1 from Nina
Hello,
I get the same problem with linux, but I dont find the solution. Can you help me please
Regards
Arjun