Code: Select all
$command = "* * * * * /usr/local/bin/php /home/joshg/public_html/test.php";
$cron_file = "/home/joshg/public_html/cron/cronexec";
if (file_exists($cron_file)){
file_put_contents($cron_file, $command);
exec("crontab $cron_file");
} else {
touch($cron_file);
chmod($cron_file, 0777);
file_put_contents($cron_file, $command);
exec("crontab $cron_file");
}1) I've called the "/usr/local/bin/php /home/joshg/public_html/test.php" command with PHP's exec() function and the script emailed me just like it should.
2) I went into CPanel and setup a nearly identical cron and it worked perfectly
3) I checked the cron file, the command looked fine
So basically I'm at a loss as to why it's not working. All I can assume is maybe it's something with the cron file being in my local directory? Any help would be appreciated. Thanks.
* EDIT *
I just called:
Code: Select all
echo exec("crontab -l");