php/timeout/connection to server reset?

后端 未结 6 1544
甜味超标
甜味超标 2021-01-06 02:42

I have a php script that needs to run for quite some time.

What the script does:

  • connects to mysql
  • initiates anywhere from 100 to 100,000 cURL
6条回答
  •  我在风中等你
    2021-01-06 03:13

    Well, disregarding the fact that attempting 100,000 cURL requests is absolutely insane, you're probably hitting the memory limit.

    Try setting the memory limit to something more reasonable:

    ini_set('memory_limit', '256M');
    

    And as a side tip, don't set the execution time to something ludicrous, chances are you'll eventually find a way to hit that with a script like this. ;]

    Instead, just set it to 0, it functionally equivalent to turning the execution limit off completely:

    ini_set('max_execution_time', 0);
    

提交回复
热议问题