I have to create a crontab file using php script.This is my code :
<?php
file_put_contents('/tmp/crontab.txt','* * * * * NEW_CRON'.PHP_EOL);
echo exec('crontab /tmp/crontab.txt');
?>
the file crontab.txt is created.But the next command 'crontab /tmp/crontab.txt' is not executed.When I type the command 'crontab -l',i get the output : 'no crontab for root'.But when I manually execute the command in terminal,the crontab is installed correctly.Why cant I execute the same command using my php script?