jadeg Posted April 21, 2014 Share Posted April 21, 2014 I have a PHP function and I want the function to be called every minute. I know how to do this in javascript, just don't know how to make it work in PHP. How do I go about that Quote Link to comment https://forums.phpfreaks.com/topic/287921-calling-function/ Share on other sites More sharing options...
trq Posted April 21, 2014 Share Posted April 21, 2014 PHP doesn't execute inside an event loop like Javascript often does. You would need to use your operating systems task scheduler. On Linux, it is called cron. Quote Link to comment https://forums.phpfreaks.com/topic/287921-calling-function/#findComment-1476893 Share on other sites More sharing options...
jadeg Posted April 22, 2014 Author Share Posted April 22, 2014 I have set up the cron job. To run on the website how do I go about that? Do I just run the script that has the cron job scheduled? Quote Link to comment https://forums.phpfreaks.com/topic/287921-calling-function/#findComment-1476922 Share on other sites More sharing options...
trq Posted April 22, 2014 Share Posted April 22, 2014 Have cron execute the script that calls your function. Quote Link to comment https://forums.phpfreaks.com/topic/287921-calling-function/#findComment-1476927 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.