linux - php exec with sudo fails on CentOS -


i running centos 6, httpd executed user 'apache'. security reasons, want use sudo executed via exec user 'aq':

<?php exec("/usr/bin/sudo -u aq somescript.sh",$output,$return_val);?> 

with visudo have added following line:

apache = (aq) nopasswd: 

furthermore temporary gave apache login shell (/bin/bash), able test

/usr/bin/sudo -u aq somescript.sh 

directly worked.

php exec fails $return_val delivers '1' if sudo invoked.

comment out line /etc/sudoers

defaults requiretty

i'v tested case in few ways ant 1 gives me success.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -