Reputation: 5732
Is it possible to create recurrent actions with PHP?
I want to execute some statements every day at 10 o'clock. I know this could be done with cronjobs, but I only have a regular webhoster that does not provide Unix access.
Upvotes: 0
Views: 562
Reputation: 5732
I found a way to fire cronjobs without Unix installed on a machine.
http://www.easycron.com/ provides cron services:
EasyCron is a task scheduler which provides services of calling URLs at specified time or by time interval. Once register with us, you get abilities to:
Some of the features:
I am not conntected to this service in any way, but it provided the solution I was looking for.
Upvotes: 1
Reputation: 522175
No, PHP does not have anything equivalent. PHP in conjunction with a web server is made to execute small scripts for a very short period of time. In order to execute something at a specific time, a PHP script would have to stay running permanently and check what time it is. You can do that in PHP, but likely not on a limited web host that optimizes for short-in-parallel scripts.
Lacking the ability to run a permanent script, and lacking any help from the system itself (cron), the only thing you can do is to make a normal web request every day at a specific time to trigger the action. I.e. the timer is on an external system that pokes your system at a specific time. That's an ugly workaround hack. Look for a better host if you want something nicer.
Upvotes: 2