Executing a command as apache
- by Lord Loh.
This script keeps outputting a 1. and I cannot understand why.
<?php
passthru("nohup sudo rndc reload sd.example.com",$op);
print_r($op);
?>
I have also tried the above code without the nohup. I have the following line in my sudoers file
apache ALL = NOPASSWD: /usr/sbin/rndc reload sd.example.com
Just to test, temporally, I allowed apache a shell, logged in as apache by sudo su apache and successfully managed to execute sudo rndc reload sd.example.com.
I do not see any error message in my log files wither. What could I be possibly doing wrong? None of the similar threads have pointed me to anything that solved my problem or debug it.