简体   繁体   English

PHP Curl错误60查询reCAPTCHA API

[英]PHP Curl error 60 querying reCAPTCHA API

I have a PHP site that queries several APIs via HTTPS. 我有一个PHP站点,可通过HTTPS查询多个API。 All work, except for reCAPTCHA. 所有工作,除了reCAPTCHA。 This produces the following error: 这将产生以下错误:

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

A common solution to this problem is to download a .pem file from the curl site and add it to the PHP.ini file, which I did: 解决此问题的常见方法是从curl网站下载.pem文件并将其添加到PHP.ini文件中,我这样做是:

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="/var/www/cacert.pem"

[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile="/var/www/cacert.pem"

The error still happens. 该错误仍然会发生。 If I check phpinfo() the curl property is not set, but the openssl property is: 如果我检查phpinfo() ,则没有设置curl属性,但是openssl属性是: PHPinfo文件 PHPinfo文件

I have restarted php-fpm and hard rebooted the server to no avail. 我已经重新启动了php-fpm并重新启动了服务器,但无济于事。 There are no relevant errors in the startup log. 启动日志中没有相关的错误。

I am using PHP Version 7.2.4-1+ubuntu14.04.1+deb.sury.org+1 我正在使用PHP版本7.2.4-1+ubuntu14.04.1+deb.sury.org+1

通过将OpenSSL升级到最新版本OpenSSL 1.1.0h 27 Mar 2018解决了此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM