Problem scenario
You are trying to get a PHP file to invoke a bash script. When you run it from the command line with "php foobar.php" you just see the content of the PHP file. What do you do to get PHP to invoke a bash script?
Solution
Make sure you have the correct header and closing symbols. Here is the content of foobar.php:
<?php
exec('bash /var/www/html/testScript.sh');
?>
To run it, do this: php foobar.php