Recursive run PHP scripts?

0 like 0 dislike
77 views
Is it possible to recursively run the script?


To make it clearer, give an example.

Suppose you have a list of images (id — filepath) that you want to process. We call the script a.php with the id parameter of the first image, for example a.php?id=1. The script handles a single image, and calls itself, but with the id parameter the following images for example a.php?id=2, and he dies. Is it possible to implement such a system?
by | 77 views

7 Answers

0 like 0 dislike
In this issue also raised the question of run a certain task in php in a separate process:
by
0 like 0 dislike
if by "processing" does not mean the withdrawal of enough something like this:
//reference to a.php?id=0
//processing of images with id=0
$id=$_GET['id'];
$id++;
header("Location: site.ru/a.php?id=$id");
by
0 like 0 dislike
And not if the CRON for this purpose?
\r
If you know the approximate time of processing one image, it is better to configure the script the cron every N minutes. He php script gets the next image and starts processing, and then marks this task as done and completed.
by
0 like 0 dislike
Here's another option, which is probably not in all cases, but still love it...
\r
If applicable, is the html page where you ajax'ω, a request is sent to a php script on the server. After returning a successful response we have a break and send the request again. And so on.
\r
I did compile a Sitemap for your site.
\r
Requirements: download original html page in the browser
Limitation: maximum execution execute a php script (in the server settings).
by
0 like 0 dislike
What are you doing with the images? I think you can do without the perverted.
But to call php from console option in the beginning of the script to write so
\r
if ($argc > 0) { for ($i=1; $i < $argc; $i++) { parse_str($argv[$i], $tmp); $_REQUEST = array_merge($_REQUEST, $tmp); } } 

and cause so
exec("/usr/bin/php /var/www/c.php id=1 > /dev/null &");
by
0 like 0 dislike
As Varian at the end of script execution with a.php?id=1 send get/post http request to the script with a.php?id=2.
by
0 like 0 dislike
Under Apache you can use virtualthat performs epicheskie subqueries, but there is a tough tie from the Apache, for different servers, you can emulate this functionality by making an external request (via curl, socket's, Yes, at least file_get_contents), well, that one script is not waiting for the other to complete first after the hard interrupt request, and the second set ignore_user_abort
And if not a secret, why are you such a crafty delights?
by

Related questions

0 like 0 dislike
4 answers
0 like 0 dislike
4 answers
0 like 0 dislike
5 answers
asked May 22, 2019 by khomaldi
0 like 0 dislike
3 answers
asked Apr 14, 2019 by sasnnick
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
28,802 users