I was following the guide written here Run Bash Command from PHP
and I have /var/www/test.php
<?php $old_path = getcwd();
chdir('/home/');
$output = shell_exec('./test.sh');
echo "<pre>$output</pre>";
chdir($old_path); ?>
and located by using sudo nano /home/test.sh
#/bin/bash
mystring="Hello World"
echo "$mystring"
yet running locally http://localhost/test.php
I get a blank page.
I can run the file from the terminal, and I can run shell_exec('ls') successfully as php script, can anyone see what I am doing wrong please?