错误设置证书验证从StackOverflow上的问题位置
问题描述:
OS: Ubuntu 16.01
PHP: 7/0
基于一些google搜索,输入,我设置以下卷曲选项:错误设置证书验证从StackOverflow上的问题位置
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO = '/etc/ssl/certs',
我验证了的/ etc/SSL /证书目录存在,并且它是最新的。
我还修改了文件/etc/php/7.0/cli/php/ini:
openssl.capath='/etc/ssl/certs'
当我尝试做了Curl电话,我得到以下错误:
[error] => error setting certificate verify locations:
CAfile: /etc/ssl/certs
CApath: /etc/ssl/certs
我编辑的权限在/ etc/SSL /证书到:
rwxr-xr-x
但我得到同样的错误。
任何想法?如果你想使用的证书是在短短的一个文件
答
CURLOPT_CAINFO
才应该设置。如果你想使用整个目录(就像你通常想在Ubuntu上执行的那样),只需设置CURLOPT_CAPATH
值。
从the docs:
CURLOPT_CAINFO: The name of a file holding one or more certificates to verify the peer with.
CURLOPT_CAPATH: A directory that holds multiple CA certificates.