title: run command as root via php
body: <p>I have a php script which contains su. when I run it in shell it ask for root password and works well. but now I want make an interface for it. as you know all command in php-apache runs as www-data user and this user doesn't have specified password or it's not in sudoers. so I can't use "echo pass | sudo -S ..." because I don't know what is www-data's password and It is not logical on every server set password for www-data or add it in sudoers+nopass, is it?</p>
  
  <p>What solution can you suggest to solve this problem?</p>
  
  <p>one of my commands:</p>
  
  <pre><code>su -c \"/usr/sbin/dmidecode -s baseboard-serial-number | tr \  \-\"
  </code></pre>