How to execute a program written in PHP in stages?

Good evening, there is a program that downloads images to a server written in PHP. It opens in the browser as a regular page, after is the downloading of the images, but downloading is time-consuming and error 500. At low volumes this is not a problem.
How to make a program:
  1. Download page
  2. Download for example 100 images
  3. Stop in and say 100 images downloaded
  4. Run 2 and 3 the points until everything is downloaded
June 14th 19 at 20:28
2 answers
June 14th 19 at 20:30
Solution
Well for starters at least try it:
0. To watch the logs, what error occurs
1. To increase memory_limit
2. To increase max_execution_time
All increased till the huge sizes - mina_Weimann commented on June 14th 19 at 20:33
updated the answer in the logs? - dayne.Berge commented on June 14th 19 at 20:36
to run via cli - summer_Ankunding commented on June 14th 19 at 20:39
With the servers not very understand. Where can I see them ? - mina_Weimann commented on June 14th 19 at 20:42
And how ? - mina_Weimann commented on June 14th 19 at 20:45
what environment are you using? OpenServer, Denver, Linux installed on it pyhom, it happens locally or remotely? the more you tell us, the faster you will respond. But if another code will apply, it should not be - dayne.Berge commented on June 14th 19 at 20:48
located access.log and error.log - noe commented on June 14th 19 at 20:51
nice, but you have not answered all my questions. We need the logs - dayne.Berge commented on June 14th 19 at 20:54
Thanks for the help big. Now look for - mina_Weimann commented on June 14th 19 at 20:57
in the root of your hosting, look for the file error_log. It is unlikely that he will be there, but still - dayne.Berge commented on June 14th 19 at 21:00
you have ssh access? it's a vps or shared hosting? - dayne.Berge commented on June 14th 19 at 21:03
well you see, in the logs all beautifully written, why it does not work for you)) - dayne.Berge commented on June 14th 19 at 21:06
Thank you very much, I thought the problem lies elsewhere - mina_Weimann commented on June 14th 19 at 21:09
and these errors are displayed immediately in the browser, in the top of your script put
ini_set('display_errors', 1);
error_reporting(E_ALL);

But this is only for dev mode. Better the users this does not show - dayne.Berge commented on June 14th 19 at 21:12
June 14th 19 at 20:32
1. Ajax sends a request to save 100 photos
2. Get the offset in the result of ajax request
3. Sent a new request
4. Repeat

Find more questions by tags PHP