smus Posted March 29, 2017 Share Posted March 29, 2017 I know, it's pretty common question, but I wonder if there is a way to schedule a PHP script to be executed periodically (with some intervals) without using server utilities, such as Cron? Link to comment Share on other sites More sharing options...
dsonesuk Posted March 29, 2017 Share Posted March 29, 2017 Yes! but you will just be using an alternative server script language to do exactly what php cron does. OR set scheduled times on phone/tablet as alarms and do them manually Link to comment Share on other sites More sharing options...
smus Posted March 30, 2017 Author Share Posted March 30, 2017 But hypothetically, if we take, for example, time constant from PHP that contains fixed date and time value, then set an interval and place it to a "perpetual" cycle - we will be able to make it, isn't that possible? Or it is too complicated? Link to comment Share on other sites More sharing options...
dsonesuk Posted March 30, 2017 Share Posted March 30, 2017 Perpetual loop would continue until condition met, problem is no other coding would be processed until that condition is meet. A user sends request to web server, the web server processes server script language and returns result, that won't happen here it would continue to process until condition met, but max execution time would run out by then and would be exiting out with error message explaining why, 'max_execution time exceeded'. You might be able to use ajax using js setInterval() to run php script to compare time to current, and if equals or exceeds run scheduled task, but that could cause slowness in website with js always running in backgrond. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 30, 2017 Share Posted March 30, 2017 Why don't you want to use cron? That's the only solution which only requires the web server to be running. Anything else requires another computer or another program to run, so why is cron not an option? Link to comment Share on other sites More sharing options...
davej Posted March 30, 2017 Share Posted March 30, 2017 What type of server or what type of hosting are you talking about? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now