Maciej Jaśniaczyk
Maciej Jaśniaczyk

Reputation: 605

How to run long running php process

I'm working with some web services that are giving big amount of data. The time of WS reply has made us to download data it contains (on daily basis, as cronjob).

However I have difficulties with test the script to parse data. Whole script will probably run about 1-2 hrs. After few minutes script gets interrupted. The browser returns a file download prompt (name of file: "name_of_action" without extension).

I'm running this as webserver script, in apache server (Zend server to be specific). Tried:

set_time_limit(0); 
ignore_user_abort();

and setting long execution times in php.ini - nothing helps. Script keeps getting interrupted.

Best regards and thanks in advance for any help

Upvotes: 0

Views: 2828

Answers (1)

Claaker
Claaker

Reputation: 257

If you still want to stick with PHP for this kind of task, you should consider executing your script in the server shell, via PHP cli.

Also, there are tools that can help you running your script in background, like screen or even doing it via a cronjob.

Upvotes: 3

Related Questions