title: Run Shell script file from Apache web server
body: <p>I am running an Apache 2 webserver. I would like to have a button which, when pressed, activates a shell script.
  I have found similar questions which have an answer to use a php file.</p>
  
  <p>The html file is like this:</p>
  
  <pre><code>&lt;form action="testexec.php"&gt;
      &lt;input type="submit" value="Open Script"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And the PHP file is like this:</p>
  
  <pre><code>&lt;?php
  shell_exec("./test.sh");
  ?&gt;
  </code></pre>
  
  <p>However, when I click the button on the html page, it brings up the php page but nothing runs. If I do: php testexec.php in the terminal everything runs fine.</p>
  
  <p>Is there any way to fix this? 
  Thanks in advance</p>
  
  <p>Edit: I tried replacing the php script to just exec instead of shell_exec but it still doesn't work. I also tried replacing './test.sh' with a python script command 'python pythonscript.py' but the python script wouldn't run either apart from when I ran it from the terminal.
  Is it something to do with Apache?</p>