0

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 have been restarting httpd each time I made changes to the sudoers file.

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.

Lord Loh.
  • 1,049
  • 3
  • 15
  • 24
  • Did you look at the sudo logs or only the apache logs? – Jenny D Nov 04 '13 at 11:41
  • I was only looking at the Apache Logs. I did not even have a sudo log. Once I configured sudo to start logging, I saw the error - `sorry, you must have a tty to run sudo @ sudoers_policy_main()`. I had faced this error before, except that time I had seen this show up in apache error logs. once I made an exception for apache to be ale to run without a tty, the above script worked. @JennyD - Thanks for that pointer :-) – Lord Loh. Nov 04 '13 at 13:39
  • Glad I could help! – Jenny D Nov 04 '13 at 13:54

0 Answers0