Answer the question
In order to leave comments, you need to log in
CRON equivalent in PHP?
Yes, google has been looked at. Perhaps bad, but still: there is a sync.php file, there is mysql, There is no access to crontab and the server in principle.
how to create an analogue of cron in pure php (mb + mysql) without using linux utilities?
Conditions: the most rotten shared hosting, with the lack of the ability to connect web server modules, and without access to it at all, there is no "schedule" functionality in the interface. There is phpMyAdmin.
(Yes, it is clear that it is better to change the hosting). But, let's say.
There is an idea that, for example, to force a script to be executed from a remote server (where there is access to everything), say, a POST / GET thread, etc. But it's not interesting. Would like to think of a pure PHP/MYSQL solution
Answer the question
In order to leave comments, you need to log in
"Relay" mode:
1. Run a PHP script (our "cron" in PHP),
2. Check the tasks in the database (and execute if necessary),
3. Wait for some time (sleep),
4. Request ourselves via GET (GOTO 1).
5. Immediately (after GET) we complete the work of the current one.
We issue commands to manage our PHP cron through the database using another PHP script, namely control through the database.
Very stupid option, but it seems that they did it before.
On every nth request to the main page, run sync.php with a time check. Or, on each request of the main page, check the time and run sync.php accordingly. The main thing is that the visits should be at the right time for the script to run.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question