2

I was looking for a php script that will get executed every hour ( without executing it ) ( ex. for sending emails ) but i don't know, the way it works. Do i have to use Cron Jobs or is there anything in php to make such kind of scripts?

Thank you

0

3 Answers 3

8

PHP does not have anything like this included. You have to use an external tool, such as cron, to run a PHP script perdiodically.

If you are not allowed to set cron jobs on your web hosting, there exist websites that will call one URL periodically, like http://www.onlinecronjobs.com/.

Sign up to request clarification or add additional context in comments.

2 Comments

Ohh.. I saw IPB Forums using something ( don't know what ) for generating RSS every mentioned minutes. So do they install Cron jobs thr' php scripts?
You can also use what is known as Poor mans cron (like Poormanscron in drupal) or PMC.
1

You need to use cron jobs if you want it to run on a set schedule.

1 Comment

Thank you, but installing cron jobs manually is.. or i can do something with php script to install that cron job for me?
0

Yes, if you are using linux, go to the terminal and type crontab -e.

Your line will be something like that

1  2 3 4 5 (this line here is just an information.. dont type it on crontab)
00 * * * * wget www.page.com/yourphp.php

So the script will run 1 00 On minute 00 2 * Every hour 3 * Every day 4 * Every month 5 * Every day of the week

Then type :wq to close So its done.

You need to have the crontab and the wget in this scenario.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.