unix - PHP CronJob doesn't work -
i'm trying set cronjob sends me email when runs.
when execute file using ssh command via putty, works, works when set url, doesn't work when setting using absolute path.
here i've tried till : work :
* * * * * http://example.com/cron/cron.php doesn't work :
* * * * * php /var/www/clients/client2/web6/web/global/cron/cron.php * * * * * /var/www/clients/client2/web6/web/global/cron/cron.php * * * * * /usr/bin/php /var/www/clients/client2/web6/web/global/cron/cron.php all 3 listed in 'doesn't work' works when executed commands through putty
file permissions sorted out , 777 cron file, , directory resides in.
i'm using ispconfig3 , debian , apache2, if matters
edit : here's code in cron.php :
#!/usr/bin/php <?php $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'from: cronjob <cronjob@example.com>' . "\r\n"; mail("peeyush@example.com", "cronjob complete - ". date('d-m-y'), "at".date("h:i:s"), $headers); ?>
run find directory:
<?php print __file__; ?> try this:
* * * * * php /var/www/clients/client2/web6/web/global/cron/cron.php this how crons work on website.
Comments
Post a Comment