How to create cron job using PHP? up vote18d own vote 10 favorite I'm new to using cron job. I don't even how to writ
Views 135 Downloads 0 File size 222KB
How to create cron job using PHP?
up vote18d own vote 10
favorite
I'm new to using cron job. I don't even how to write it. I have tried to search from internet, but i still don't understand it well. I want to create a cron job that will execute my code every minute. I'm using PHP to create it. It is not working. Example run.php (Code that will be executed every minute)
cron.php
Suppose that these two files are in the same folder. Is the code that I did wrong? If wrong, please kindly tell me how to fix it. Thanks in advance. php
cron
shareimprove this question
edited Sep 11 '13 at 10:34
asked
mu 無
user2738520
17.1k82754
137
do you have shell access on the server? – Dagon Sep 11 '13 at 9:31
3 You can't just echo out *** and expect a cronjob to be created. Read up here how to create cronjobs (assuming y on a server running linux) thesitewizard.com/general/set-cron-job.shtml – tlenss Sep 11 '13 at 9:31 @Dagon: i don't know about this. I'll check it out. – user2738520 Sep 11 '13 at 9:40 It is a one off event so use crontab – Ed Heal Jan 26 '14 at 16:49 add a comment
6 Answers activeoldest
votes
up vote9do wn vote
In the same way you are trying to run cron.php, you can run another PHP script. You will have to do so via the CLI interface though. #!/usr/bin/env php