nginx - PHP Error:Operation timed out after 35007 milliseconds with 0 bytes received -


i installed nginx1.10 , php5.6 on win7, running php found unable curl request same port php script.

http://localhost/a.php curl request http://localhost/phpinfo.php,error tips error:operation timed out after 35007 milliseconds 0 bytes received.

server {     listen 80;     server_name localhost;     root d:/localhost;     index index.html index.htm index.php;     autoindex on;     autoindex_localtime on;      location ~ \.php$ {         fastcgi_pass   127.0.0.1:9000;         fastcgi_index  index.php;         fastcgi_param  script_filename  $document_root$fastcgi_script_name;         include        fastcgi_params;     } } 

http://localhost/a.php

<?php function makerequest($url, $params, $method = 'get') {     $ch = curl_init();     if ($method == 'get') {         $url .= '?' . http_build_query($params);     } else {         curl_setopt($ch, curlopt_post, 1);         curl_setopt($ch, curlopt_postfields, $params);     }      if (substr($url, 0, 6) == 'https:') {         curl_setopt($ch, curlopt_ssl_verifypeer, false);         curl_setopt($ch, curlopt_ssl_verifyhost, false);     }     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_returntransfer, true);     curl_setopt($ch, curlopt_useragent, 'apiclient/v1.0');     curl_setopt($ch, curlopt_connecttimeout, 30);     curl_setopt($ch, curlopt_timeout, 35);       $result = curl_exec($ch);     $info = curl_getinfo($ch);     $error = curl_error($ch);      curl_close($ch);     print_r($info);     var_dump($error);     return $result; }   $url = 'http://localhost/phpinfo.php'; makerequest($url, []); 

output:

array (     [url] => http://localhost/phpinfo.php?     [content_type] =>      [http_code] => 0     [header_size] => 0     [request_size] => 96     [filetime] => -1     [ssl_verify_result] => 0     [redirect_count] => 0     [total_time] => 35.007     [namelookup_time] => 0.016     [connect_time] => 0.219     [pretransfer_time] => 0.219     [size_upload] => 0     [size_download] => 0     [speed_download] => 0     [speed_upload] => 0     [download_content_length] => -1     [upload_content_length] => -1     [starttransfer_time] => 0     [redirect_time] => 0     [redirect_url] =>      [primary_ip] => 127.0.0.1     [certinfo] => array         (         )      [primary_port] => 80     [local_ip] => 127.0.0.1     [local_port] => 55978 )  d:\localhost\a.php:37:string 'operation timed out after 35007 milliseconds 0 bytes received' (length=66) 

but

i have found if use different port, php initiates request uses port, , response request's php uses port, , execution timeout not occur.

i know why,because php-cgi not php-fpm, php-cgi not automatically start new process, once occupied locked.


Comments