'Bash or shell script for run my PHP file as long as it has iterations to perform

I am not very good with bash or shell script. I would like to know if what I want to do is possible.

I have a big request to do with PHP. Only when I launch it my server is in Timout (and I can't extend it). I had the idea to split the PHP requests in iterations. Every time I reload my page, my script iterates over a JSON file.

I want to know if I can use a script with a CRON to run my PHP file as long as it has iterations to perform. And if I can use a response from my PHP in my bash to stop the script when everything is finished?

I apologize for my English, thank you for your time. I have searched the web several times, but I can't find an answer to use a php file with a bash script with iterator.

Thanks in advance,



Solution 1:[1]

Thank to Andrea Olivato :

If it's just a timeout problem and your script would work, just run it from command line. php script.php Assuming you have a non-infinite loop in your script, it will automatically stop once it finishes everything

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MajorKurk