Call Bash script inside php web page

Valic —  June 17, 2011 — Leave a comment

There is a simple way to call a simple bash script inside php script page:

- Below is a simple bash script called

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/”;
$ver1 = system($script, $retval);
if ($retval == 0 ) {
echo “Returned 0″;
else {
echo “Returned not zero”;


Save this to same root location where your is.

If you browse the page testing.php, it would have a return value spitted out by bash script.

You can call this script from here :



Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply