Shell script in php

i have some problem to shell script using php…
my script is file is a.sh:::

#!/bin/sh

echo “ATZ0” > /dev/ttyACM0
echo “AT+CSCA?” > /dev/ttyACM0
echo “AT+CMGF=1” > /dev/ttyACM0
echo “AT+CNMI=2,1” > /dev/ttyACM0
echo “AT+CMGS=\“09924927267\”” > /dev/ttyACM0
echo “hello\32” > /dev/ttyACM0

and my php file is index.php::

<?php
exec(“./a.sh”);

?>

i cant run this script…pls help me with this

See if this does anything:

$output = shell_exec('./a.sh');
echo "<pre>$output</pre>";

src: http://php.net/manual/en/function.shell-exec.php

nothing is happening…

Try using your full path from root e.g. /home/user/www/a.sh and CHMOD the shell script to 777.


<?php
exec(" /home/user/www/a.sh ");
?>

still its not working should i shift to another platform like jsp??

It looks liek you are trying to access a modem or serial port? If so, this should help you:
http://www.lspace.nildram.co.uk/freeware.html

-Bing

You might be able to write to /dev/ttyACM0 directly from PHP with proc_open().