Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php curl证书验证失败,但仅在一台计算机上_Php_Validation_Curl_Ssl Certificate - Fatal编程技术网

php curl证书验证失败,但仅在一台计算机上

php curl证书验证失败,但仅在一台计算机上,php,validation,curl,ssl-certificate,Php,Validation,Curl,Ssl Certificate,这是我正在运行的代码: $ch = curl_init('https://core.spreedly.com/v1/payment_methods/P94ca6iTsZ4fHwiP7j8tmG17fH1/retain.xml'); curl_setopt($ch, CURLOPT_CAINFO, '/home/scrutinizer/build/vendor/guzzlehttp/guzzle/src/cacert.pem'); $res = curl_exec($ch); var_dump($

这是我正在运行的代码:

$ch = curl_init('https://core.spreedly.com/v1/payment_methods/P94ca6iTsZ4fHwiP7j8tmG17fH1/retain.xml');
curl_setopt($ch, CURLOPT_CAINFO, '/home/scrutinizer/build/vendor/guzzlehttp/guzzle/src/cacert.pem');
$res = curl_exec($ch);
var_dump($res);
var_dump(curl_error($ch));
它产生这个输出:

bool(false)
string(125) "server certificate verification failed. CAfile: /home/scrutinizer/build/vendor/guzzlehttp/guzzle/src/cacert.pem CRLfile: none"

但只在这个服务器上!当我在另一台机器上运行它时,同样的设置—Ubuntu14.04LTS—同样的php、curl等版本,它运行得非常完美。当一台服务器在另一台服务器上运行时,什么会导致证书验证失败?

您是否在服务器上添加了cacert.pem文件?@bhumisah否,该问题特定于git-mine特定于php。我已经尝试过从命令行手动运行curl调用,设置相同,但效果很好-因此它只在php中发生。@Bhumisah我正在通过CURLOPT_CAINFO指定cacert文件,它会覆盖服务器文件,并且我已经确认该文件没有权限/可读性问题。您尝试过curl_setopt吗($ch,CURLOPT_SSL_VERIFYPEER,TRUE);?@bhumisah是的,我收到一条错误消息,说它不再接受1的值,我应该使用2。