I can not call the script through curl_multi_exec - GateWay timeout falls out
how do i call:
set_time_limit(0); $common_counter=0; $ii=0; $counter = 0; $curl_arr = []; $master = curl_multi_init(); while ($common_counter<10000) { $common_counter++; $ii++; if ($ii>=950) { $ii=0; $curl_arr[$counter]=curl_init(); curl_setopt($curl_arr[$counter], CURLOPT_URL, "https://www.example.ru/send-notif/send_notifi.php"); curl_setopt($curl_arr[$counter], CURLOPT_HEADER, 0); ///curl_setopt($curl_arr[$counter], CURLOPT_SSLVERSION, 3); curl_setopt($curl_arr[$counter], CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl_arr[$counter], CURLOPT_RETURNTRANSFER, true); curl_multi_add_handle($master, $curl_arr[$counter]); $counter++; } } $counter++; $active = null; do { $master_res = curl_multi_exec($master,$active); echo ' 1 :'. $master_res.' + active='.$active; } while($master_res == CURLM_CALL_MULTI_PERFORM || $active); while ($active && $master_res == CURLM_OK) { // Wait for activity on any curl-connection if (curl_multi_select($master) != -1) { // Continue to exec until curl is ready to // give us more data usleep(100); } do { $mrc = curl_multi_exec($master, $active); echo ' 2 :'.$mrc; } while ($mrc == CURLM_CALL_MULTI_PERFORM || $active); } foreach ($curl_arr as $key ) { curl_multi_remove_handle($master, $key); } curl_multi_close($master); hangs on the first loop. My echo line is 1: 0 + active = 10 i.e. $ master_res == 0 always and 10 active requests
The script itself is:
$to = 'my@mail-example.ru'; $subject = 'the subject'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = 'send_notification teest notif ' ; mail($to, $subject, $message, $headers); echo "1"; It does not give any errors (or I do not know where to get them), but it does not work either. Tell me where to dig, I'm already tired. I feel some options through curl_setopt did not set, but I can not find any.
PHP Version 5.6.29-0 + deb8u1 curl 7.38.0