php - Curl_multi_xxx cause connection reset -


i use curl_multi requesting url concurrently. works several loops(about 10), webpage "net::err_connection_reset" after few seconds.
try find out line make page down, found might curl_multi_exec or curl_multi_select. page run on friend's computer in same environment(win7 , xampp's default setting different version maybe).
may cause curl_multi_exec or curl_multi_select going wrong?

<?php set_time_limit(0); include 'tool_jsonrw.php'; error_reporting(e_all); $url_array = array(); $data = array(); $filename = 'start.txt'; $file_handle = fopen($filename, "r"); $flag = fread($file_handle, filesize($filename)); fclose($file_handle); $mh = curl_multi_init(); // multi curl handler  while(strcmp($flag, '1') == 0){     $url_array = readjson("ip_list.json");     $url_array = $url_array['rows'];      $i = 0;     foreach($url_array $url) {         $url = "http://127.0.0.1/proxy/mgcproxy_0.16.15.0701.0/mgcproxy_0.16.15.0701.0/mgcproxy/mgc_list_17.php?ip=".$url;         echo '<pre>url  ', print_r($url, true), '</pre>'."\n";         $ch = curl_init();          curl_setopt($ch, curlopt_url, $url);         curl_setopt($ch, curlopt_header, 0);         curl_setopt($ch, curlopt_timeout, 1);         curl_setopt($ch, curlopt_connecttimeout, 1);          curl_multi_add_handle($mh, $ch); //         $handle[$i++] = $ch;     }      $running = null;     {         curl_multi_exec($mh, $running);         curl_multi_select($mh);     } while ($running > 0);      /* 移除 handle*/     foreach($handle $ch) {         curl_multi_remove_handle($mh, $ch);     }      usleep(500);     $file_handle = fopen($filename, "r");      $flag = fread($file_handle, filesize($filename));      fclose($file_handle);      ++$a; } curl_multi_close($mh); ?> 

here apache's error log, i'm new in web developing, please let me know should post guys me :)

[wed jul 15 14:43:11.175407 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00428: parent: child process 5940 exited status 3221225477 -- restarting.<br> [wed jul 15 14:43:11.250407 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00455: apache/2.4.7 (win32) openssl/1.0.1e php/5.5.9 configured -- resuming normal operations<br> [wed jul 15 14:43:11.250407 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00456: apache lounge vc11 server built: nov 21 2013 20:13:01<br> [wed jul 15 14:43:11.250407 2015] [core:notice] [pid 8384:tid 256] ah00094: command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d c:/xampp/apache'<br> [wed jul 15 14:43:11.255407 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00418: parent: created child process 6660<br> [wed jul 15 14:43:11.680408 2015] [mpm_winnt:notice] [pid 6660:tid 268] ah00354: child: starting 150 worker threads.<br> [wed jul 15 14:43:18.430417 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00428: parent: child process 6660 exited status 3221225477 -- restarting.<br> [wed jul 15 14:43:18.505417 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00455: apache/2.4.7 (win32) openssl/1.0.1e php/5.5.9 configured -- resuming normal operations<br> [wed jul 15 14:43:18.505417 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00456: apache lounge vc11 server built: nov 21 2013 20:13:01<br> [wed jul 15 14:43:18.505417 2015] [core:notice] [pid 8384:tid 256] ah00094: command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d c:/xampp/apache'<br> [wed jul 15 14:43:18.510417 2015] [mpm_winnt:notice] [pid 8384:tid 256] ah00418: parent: created child process 9264<br> [wed jul 15 14:43:18.890418 2015] [mpm_winnt:notice] [pid 9264:tid 268] ah00354: child: starting 150 worker threads. 

i solved problem, it's caused php_curl.dll's version. if use version below 7.36, page crash when

curl_multi_exec($mh, $running); curl_multi_select($mh); 

just update dll's version, curl_multi works well!


Comments