[英]curl works on command line, not in PHP
我在运行 Apache/2.4.39 和 PHP 7.2.18 的 Fedora R 28 上运行 Drupal 8。 我的 php curl function 失败,但命令行测试工作正常。
curl 出现在 phpinfo() 中,在 20-curl.ini 中定义,并且在任何日志文件中都没有显示任何错误。 我尝试了两种不同的 SSL 证书。 测试返回飞行 colors。
协议 TLS 1.3 否 TLS 1.2 是 TLS 1.1 是 TLS 1.0 是 SSL 3 否 SSL 2 否
我得到的只是: cURL 错误(7):无法连接到服务器
echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled'
返回启用。
array(26) {
["url"]=>
string(23) "http://www.example.com/"
["content_type"]=>
NULL
["http_code"]=>
int(0)
["header_size"]=>
int(0)
["request_size"]=>
int(0)
["filetime"]=>
int(-1)
["ssl_verify_result"]=>
int(0)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0.000437)
["namelookup_time"]=>
float(0.004549)
["connect_time"]=>
float(0)
["pretransfer_time"]=>
float(0)
["size_upload"]=>
float(0)
["size_download"]=>
float(0)
["speed_download"]=>
float(0)
["speed_upload"]=>
float(0)
["download_content_length"]=>
float(-1)
["upload_content_length"]=>
float(-1)
["starttransfer_time"]=>
float(0)
["redirect_time"]=>
float(0)
["redirect_url"]=>
string(0) ""
["primary_ip"]=>
string(0) ""
["certinfo"]=>
array(0) {
}
["primary_port"]=>
int(0)
["local_ip"]=>
string(0) ""
["local_port"]=>
int(0)
}
cURL error (7):
Couldn't connect to server
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.