php shell_exec not working with crontab
Hi,
I have a php script that use shell_exec for example to print the contents of crontab -l. The script works fine when i call it from terminal by php.
php test.php
But it does not work when i add it in crontab.
The script is like,
<?php
$output=shell_exec('crontab -l');
file_put_contents("testing.txt", "<pre>$output</pre>");
file_put_contents("finished.txt",'the cron has run successfully.');
?>
Crontab:
10 2 * * * /usr/bin/php /var/www/html/Ranjith/test.php > /dev/null 2>&1
Any idea?
|