There is a simple way to call a simple bash script inside php script page:
- Below is a simple bash script called script.sh
#!/bin/bash
echo “Successful call test script“
exit 0
You will need to set chmod 700 to be root executable. Then save the script to your apache root folder.
There is a simple php script called testing.php
$script = “/var/www/script.sh”;
$ver1 = system($script, $retval);
if ($retval == 0 ) {
echo “Returned 0″;
}
else {
echo “Returned not zero”;
}
die;?>
Save this to same root location where your script.sh is.
If you browse the page testing.php, it would have a return value spitted out by script.sh bash script.
You can call this script from here : http://www.debian-tutorials.com/testing.php
Enjoy.

Recent Comments