Php run shell script

I am trying to run a shell script from php interface

heres shell file (run.sh chmod to 777)

#!/bin/bash wget -O index.html http://markets.usatoday.com/custom/usatoday-com/html-mktscreener.asp python hw7-9.py index.html echo "done"; 

Here is the php front end

 <?php $output = shell_exec("run.sh"); echo "<pre>$output</pre>"; ?> 

But this php page returns nothing but

 <pre></pre> 
+7
source share
3 answers

Have you tried making error_reporting(-1); at the top of your php script. shell_exec disabled on your server.

+1
source

You would try $ output = shell_exec ("sh run.sh");

+1
source

Check which php / web server user is actually running as - for example, "www-user" may not have any rights to do what your script is trying to do (and not in vain).

0
source

All Articles