title: Run a sudo command with a html button
body: <p>For a project with my raspberry I want to host a simple website with a few html buttons that can run sudo commands. I tried this method:</p>
  <pre><code>&lt;?php
      if (isset($_POST['button']))
      {
           exec('sudo reboot');
      }
  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
      &lt;form method=&quot;post&quot;&gt;
      &lt;p&gt;
          &lt;button name=&quot;button&quot;&gt;Run&lt;/button&gt;
      &lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>And added www-data to the sudo group and made sure that sudo login requires no password with replacing this line in my sudoers file</p>
  <pre><code>%sudo   ALL=(ALL:ALL) NOPASSWD: ALL
  </code></pre>
  <p>But no commands are executed, not even non-sudo commands.</p>