Recaptcha: new error after upgrading php

Created on 15 Sep 2017  路  5Comments  路  Source: google/recaptcha

PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)

PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /usr/local/lib/php/recaptcha-master/src/ReCaptcha/RequestMethod/Post.php on line 68

PHP Warning: file_get_contents(): Failed to enable crypto in /usr/local/lib/php/recaptcha/recaptcha-master/src/ReCaptcha/RequestMethod/Post.php on line 68

PHP Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: operation failed in /usr/local/lib/php/recaptcha/recaptcha-master/src/ReCaptcha/RequestMethod/Post.php on line 68

EDIT: probably a certification issue....

php question

Most helpful comment

Try making use of some of the alternate request methods:

// uses http://php.net/fsockopen
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
// uses http://php.net/curl_exec
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\CurlPost());

All 5 comments

i've seen some version of this error countless times on stackoverflow, its usually fixed by simply upgrading your OpenSSL lib, it's some fixed bug with some old version of OpenSSL

This is not an adequate answer,. Problem occurs often and in various scenarios where OpenSSL version is not old

well, at least post the relevant libcurl & openssl versions as reported by <?php phpinfo(~0);, should look like this:
image

Is this issue still occurring for anyone? If so, please provide further details.

Try making use of some of the alternate request methods:

// uses http://php.net/fsockopen
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
// uses http://php.net/curl_exec
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\CurlPost());
Was this page helpful?
0 / 5 - 0 ratings