PHP curl сломан

Curl зависает при звонках. Это нарушает работу сайтов wordpress / wp-admin и вспомогательной библиотеки twillio, используемой для IP-SMS.

Эта проблема возникла после установки vsftpd и создания новых пользователей.

сценарий для проверки curl: (от google)

function nxs_cURLTest($url, $msg, $testText){  
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36"); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  $response = curl_exec($ch); 
  $errmsg = curl_error($ch); 
  $cInfo = curl_getinfo($ch); 
  curl_close($ch); 
  echo "Testing ... ".$url." - ".$cInfo['url']."<br />";
  if (stripos($response, $testText)!==false) 
    echo "....".$msg." - OK<br />"; 
  else 
  { 
    echo "....<b style='color:red;'>".$msg." - Problem</b><br /><pre>"; 
    print_r($errmsg); 
    print_r($cInfo); 
    print_r(htmlentities($response)); 
    echo "</pre>There is a problem with cURL. You need to contact your server admin or hosting provider.";
  }
}

  nxs_cURLTest("http://www.nextscripts.com/", "HTTPS to NXS", "Social Networks");
  nxs_cURLTest("http://www.google.com/intl/en/contact/", "HTTP to Google", "Mountain View, CA");
  nxs_cURLTest("https://www.google.com/intl/en/contact/", "HTTPS to Google", "Mountain View, CA");
  nxs_cURLTest("https://www.facebook.com/", "HTTPS to Facebook", 'id="facebook"');
  nxs_cURLTest("https://graph.facebook.com/", "HTTPS to API (Graph) Facebook", 'get');  
  nxs_cURLTest("https://www.linkedin.com/nhome/", "HTTPS to LinkedIn", 'rel="canonical" href="https://www.linkedin.com/');

output :

Testing ... http://www.nextscripts.com/ - http://www.nextscripts.com/
....HTTPS to NXS - OK
Testing ... http://www.google.com/intl/en/contact/ - http://www.google.com/intl/en/contact/
....HTTP to Google - OK
Testing ... https://www.google.com/intl/en/contact/ - https://www.google.com/intl/en/contact/
....HTTPS to Google - Problem
Failed to connect to www.google.com port 443: Connection timed outArray
(
    [url] => https://www.google.com/intl/en/contact/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003154
    [namelookup_time] => 0.004183
    [connect_time] => 0
    [pretransfer_time] => 0
    [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] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://www.facebook.com/ - https://www.facebook.com/
....HTTPS to Facebook - Problem
Failed to connect to www.facebook.com port 443: Connection timed outArray
(
    [url] => https://www.facebook.com/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003227
    [namelookup_time] => 0.004192
    [connect_time] => 0
    [pretransfer_time] => 0
    [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] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://graph.facebook.com/ - https://graph.facebook.com/
....HTTPS to API (Graph) Facebook - Problem
Failed to connect to graph.facebook.com port 443: Connection timed outArray
(
    [url] => https://graph.facebook.com/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003548
    [namelookup_time] => 0.004187
    [connect_time] => 0
    [pretransfer_time] => 0
    [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] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://www.linkedin.com/nhome/ - https://www.linkedin.com/nhome/
....HTTPS to LinkedIn - Problem
Failed to connect to www.linkedin.com port 443: Connection timed outArray
(
    [url] => https://www.linkedin.com/nhome/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003194
    [namelookup_time] => 0.004179
    [connect_time] => 0
    [pretransfer_time] => 0
    [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] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.

Curl все еще установлен на моем сервере, я проверил это с помощью phpinfo ();

переустановка модуля curl не помогла.

sudo apt-get install php5-curl
sudo service apache2 restart
1
задан 21 April 2016 в 16:54
1 ответ
Failed to connect to X port 443: Connection timed out

это больше похоже на сетевую проблему, нежели на php и / или curl , нужно попытаться воспроизвести его через оболочку curl и / или wget .

3
ответ дан 3 December 2019 в 18:35

Теги

Похожие вопросы