title: Allowing PHP to execute a bash script with root permissions
body: <p>how to allow a PHP script to execute a bash script with root permissions?</p>
  
  <p>Let's say there is a PHP script...</p>
  
  <pre><code>&lt;?php
  // location: /var/www/script.php
  exec("bash /var/scripts/test.sh"); // "sudo bash ..." does not work
  ?&gt;
  </code></pre>
  
  <p>and a bash script ...</p>
  
  <pre><code>#!/bin/bash
  # location: /var/scripts/test.sh
  sudo mkdir /test
  </code></pre>
  
  <p>Of course PHP and Apache should not run as root and at best only the script can be executed with root permissions. Any ideas?</p>
  
  <p>Best regards,
  Jimbo</p>