title: Raspbian - Execute .py file from PHP code
body: <p>after many research, I come here for a helping hand. I'm working on a Raspberry PI 3 with the latest raspbin OS. I have a web server ( Appache, MySQL, PHP ) running fine on it. </p>
  
  <p>I try to execute a .py file from PHP code, however, it does not work. I tried to change file location to /var/www/html, I added www-data exception to sudoers, I added </p>
  
  <pre><code>#!/usr/bin/env python
  </code></pre>
  
  <p>in start of my .py file, I tried change file ownership to give it to www-data, I tried to change www-data to a root user, but my .py still does not execute.</p>
  
  <p>My .py file work fine via SSH or direct execution.</p>
  
  <p>Here is how I launch it </p>
  
  <pre><code>exec('sudo -u www-data python /var/pi/www/html/Currenttestpy.py', $out, $status);
  
  echo 'Status : ' . $status . '.' ;
  </code></pre>
  
  <p>it return me a "1" status. I trie the same code with pi user, same result. Any help will be appreciate.</p>