Answer the question
In order to leave comments, you need to log in
How to run a loop in the background and display its result on the site?
Before me is a task beyond my strength. If the loop is running for a while, when it runs the site will load. After the cycle is completed, I need its data to be placed on the site, and thanks to this, the data changes on the site. How to make it so that when the cycle is executed, the site is loaded in the usual mode and gives access to the site information. And when the site is loaded, then the data from the cycle will come and some part of the site will change. Is it real at all?
Answer the question
In order to leave comments, you need to log in
In a normal way, queues were made for this.
Queues on Gearman and PHP
Cons: on free hostings it is not feasible or inconvenient.
Plus: it can withstand even a heavy load, the server will not fall.
It is not normal to run the script through curl or the console in the background
without waiting for completion,
it will write the result to a file or to the database
and periodically check whether the result has appeared or not.
Minus: under load, the server will fall.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question