title: Why cannot PHP execute a command from web browser?
body: <p>This is really simple but I cannot get it to work at all. Spent many hours and I've always give up. I created php script called copy.php and it should call a python script called copy.py.  </p>
  
  <p>I want to execute a command line like this</p>
  
  <pre><code> &lt;?php exec('/var/www/html/copy.py'); ?&gt;
  </code></pre>
  
  <p>Really simple. </p>
  
  <p>Why cannot I get the python script executed from php exec()? The function inside python script is to get a copy of error_log from a different directory (outside of Apache) into html directory. </p>
  
  <p>If I run that from a terminal </p>
  
  <pre><code> &gt; php copy.php
  </code></pre>
  
  <p>It did execute the function and made a copy. Why is that the web browser isn't doing it? </p>
  
  <p>Let me simplify this:</p>
  
  <p>why cannot exec("cp /var/log/httpd/error_log /var/www/html/path/to/php/script")  work? </p>
  
  <p>it works fine if I type it in terminal but not when run in a browser. </p>