E
E
EvgMul2016-05-29 20:30:36
PHP
EvgMul, 2016-05-29 20:30:36

How to execute PHP script in parts?

There is a PHP script that parses an XML file, but there are a huge number of elements in XML and very often the script crashes by timeout. Of course, you can increase the maximum script execution time in php.ini, but maybe there is an option to somehow restart the script, say after processing every 30 elements?
Thanks in advance to all who respond.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Grabko, 2016-05-29
@VGrabko

you can make a microservice for parsing

M
Maxim Timofeev, 2016-05-29
@webinar

As an option. Ajax on the client with a progress bar that breaks the process into parts. We completed the part - they returned the work, again the request, etc. You can also pull data. If this is an admin part, for example, then it’s quite a solution. If this is for the user, then there will be nuances.

A
Anatoly, 2016-05-29
@taliban

You will not be able to adequately break the xml into parts for parsing, otherwise you will have to do manual parsing. Increase the timeout and don't worry, it can be done right in the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question