G
G
Gennady2019-11-29 22:19:05
linux
Gennady, 2019-11-29 22:19:05

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

3 answer(s)
X
xmoonlight, 2019-11-29
@theblackpost

"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.

S
Sinot, 2019-11-29
@Sinot

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.

A
Alexander Taratin, 2019-11-30
@Taraflex

https://toster.ru/answer?answer_id=1097563

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question