title: PHP let www-data run a command as if it were a different user
body: <p>So I want to execute the following command in my php script:</p>
  
  <pre><code>exec("/path/to/command");
  </code></pre>
  
  <p>Because it is the www-data user who runs php scripts, i currently can not run this command.
  I have read something about suexec being able to run a command as if it was a different user. I find it rather difficult to understand how this works. </p>
  
  <p>I have already installed suexec and edited the /etc/apache2/suexec/www-data file and added:</p>
  
  <pre><code>/home/user_to_run_command/script.php
  </code></pre>
  
  <p>I have also edited /etc/apache2/sites-enabled/000-default and added:</p>
  
  <pre><code>SuexecUserGroup user_to_run_command user_to_run_command
  </code></pre>
  
  <p>Am I missing anything?</p>