PHP 查询 reCAPTCHA 时出现卷曲错误 60 API

PHP Curl error 60 querying reCAPTCHA API

我有一个 PHP 站点,它通过 HTTPS 查询多个 API。所有工作,除了 reCAPTCHA。这会产生以下错误:

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

这个问题的一个常见解决方案是从 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"

错误仍然存​​在。如果我检查 phpinfo() 未设置 curl 属性,但 openssl 属性 是:

我已经重启了 php-fpm 并硬重启了服务器,但无济于事。启动日志中没有相关错误。

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

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