Giuliano
-
Posts
3 -
Joined
-
Last visited
Posts posted by Giuliano
-
-
btherl, thank you for replying.
Using your idea, I executed the following script:
error_reporting(E_ALL); $command = exec('c:\fontes\web\sisbalance\lib\plink -serial COM6 -sercfg 4800,7,n,1,n');
With that, PHP hangs forever, just like the other script, because he waits for serial response. So I tried to send the output to a txt file, like this:
error_reporting(E_ALL); $command = exec('c:\fontes\web\sisbalance\lib\plink -serial COM6 -sercfg 4800,7,n,1,n >> c:\fontes\web\sisbalance\lib\log.txt 2>&1 &');
PHP still hangs forever. However, the serial port data is sent correctly to log.txt.
My question is: Is there a way to execute the script using plink.exe without hanging forever?
Thanks in advance!
-
Hello everybody.
I have a script that connects with a weight scale serial port, reads the data and prints the result.
Here it is:
error_reporting(E_ALL); exec('mode COM6: baud=4800 data=7 stop=1 parity=n xon=on'); $fd = dio_open('COM6:', O_RDWR); if(!$fd) { echo "Error!"; } else { sleep(5); $buffer = dio_read($fd); if ($buffer) { echo $buffer; } }
The script should print the buffer when the weight scale print some result. However PHP keeps waiting forever. No error. BUT, if I start a connection with COM6 using Hyperterminal or PUTTY before I run the script, it works perfectly.
Any ideas? I'm using Windows, Apache 2.2 and PHP 5.3
Thank you and sorry for my english.
Serial port connection works only after connecting with hyperterminal or putty
in PHP Coding Help
Posted
Hello btherl!
Do you think the script bellow is correct? I'm trying to execute it, and still PHP is hanging forever.