简体   繁体   中英

cronjob executing a php file

So I have a php file that executes each time it you reload it in the web browser. It uses PHPMailer, to send mail based on criteria in my db. I was attempting to use a cronjob to execute the file which I thought would basically do the same as reloading the page. The php file that I need to run in the cronjob is test.php , and its path is /var/www/html/mailer/test.php .

My cronjob is: 1 * * * * root /var/www/html/mailer/test.php >> /var/www/html/mailer/cron_status.log

and it should be throwing errors into that cron_status.log file, but its empty. I realize that this is firing every minute, but I'm just doing it to test the cronjob, and I really need to set it to 24hrs. With no error output, and no emails landing where they should be, I don't think I've properly setup my cronjob. This is my first time ever trying this. This is on a centos 7 droplet, and I've followed the tutorial from digital ocean with no success.

我需要确定该php文件,但是您可能需要将其更改为:

1 * * * * php /var/www/html/mailer/test.php >> /var/www/html/mailer/cron_status.log

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM