Using PHP I would like to be able to list root's crontab. I am able to run the following command as the Apache user from the command line and get the desired result:
sudo crontab -l
however, in my PHP I have the following command which does not work and returns an empty set:
exec('sudo crontab -l', $out);
print_r($out);
Is it environmental? Or permissions?
I have also tried shell_exec()
system()
and passthru()
Also, note that I have disabled SELinux and added Apache to the sudoers file so that it does not need to be prompted for a password.