0

For example, when I try to execute

$output=shell_exec('ls -l');
echo "<pre>$output</pre>";

It succesfully prints the output of 'ls -l'.

However, I cannot run a shell script which simply creates a file:

shell_exec('sh /home/ubuntu/Desktop/myScript.sh');

Is it about user access permissions defined in apache?

How can I fix it?

anubhava
  • 761,203
  • 64
  • 569
  • 643
yildizabdullah
  • 1,895
  • 5
  • 24
  • 37

1 Answers1

0

What output do you expect from that script? I shell_exec() will probably only output STDOUT, so if there's errors you will need to redirect them from STDERR like this:

<command> 2>&1

I'm guessing here, but try it with just a simple echo statement in the shell script. See if that works.

Micah
  • 96
  • 1
  • 7