title: php shell_exec sudo on CENTOS 7
body: <p>I've got an issue with shell_exec and sudo on centos 7.
  The following line gives no output while executing from apache:</p>
  <blockquote>
  <p>$stat = shell_exec('sudo scripts/usb/hidusb-relay-cmd ID=HIUPS stat');</p>
  </blockquote>
  <p>var_dump($stat); gives NULL</p>
  <p>I have added the following lines using visudo:</p>
  <blockquote>
  <p>apache ALL=NOPASSWD: /var/www/html/scripts/usb/hidusb-relay-cmd</p>
  <p>Defaults!/var/www/html/scripts/usb/hidusb-relay-cmd !requiretty</p>
  </blockquote>
  <p>In /var/log/secure I can read as follows:</p>
  <blockquote>
  <p>Jun  4 17:45:43 anhelli sudo:  apache : TTY=unknown ; PWD=/var/www/html ; USER=root ; COMMAND=scripts/usb/hidusb-relay-cmd ID=HIUPS stat</p>
  </blockquote>
  <p>I tried su - apache and running sudo as above but it works fine.
  Why I cant get the output of shell_exec, any ideas?</p>
  <p>Many thanks for your help.
  Best Regards
  bzc0fq</p>