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 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

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.

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.