Cron job to execute a PHP program

2019-09-06 00:29发布

I have a Linux server and in this I want to execute a cron job for sending birthday mail to all my friend with a PHP program. I want to create a php program that read data from database and send the mail.

I want to know the command of cron job to execute the program on every day automatically. I have no knowledge of Linux commands.

3条回答
相关推荐>>
2楼-- · 2019-09-06 00:50

This is the command to add to your crontab file:

0 0 * * * /usr/bin/php /path/to/your/script.php

Adjust the paths to the PHP interpreter and your script as necessary. It will run your script every day at midnight.

查看更多
The star\"
3楼-- · 2019-09-06 01:00

You will want to read up a little bit on the 'crontab' command but basically you will do this.

From a linux command prompt run the crontab command.

Then add this entry:

* * * * * php yourscript/path

You can set what time by modifying the * values. See this URL for information on that:

http://adminschoice.com/crontab-quick-reference

查看更多
一纸荒年 Trace。
4楼-- · 2019-09-06 01:02

This is done using a cron table in unix systems, including linux. Check out some example documentation:

You'll find many more, if you google for crontab, or if you check out the man crontab pages on your linux box

查看更多
登录 后发表回答