[solved] Problems with reCaptcha not being validated

ojs

#1

Yesterday I started to get errors in user registration like: “The characters you entered did not match the characters in the image. Please check the characters and try again.”

I’m using reCaptcha v2 since 14/02 and just now it is failing. On the Google website there is this warning:

We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information.

reCAPTCHA%20%20Easy%20on%20Humans%20%20Hard%20on%20Bots

Apparently my OJS stopped verifying the information. What could have caused that? And what can I do about that?

EDIT: Digging a bit more I got complains about validation since I updated to 2.4.8-3 and started using reCaptcha v2 last week. On the same day of the installation an user reported this problem.

EDIT2: Digging more I found this:

[Mon Feb 19 09:39:08.382556 2018] [:error] [pid 780] [client 200.145.66.44:2236] ojs2 has produced an error\n  Message: WARNING: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?\n  In file: /usr/home/seer/public_html/lib/pkp/lib/recaptcha/recaptchalib.inc.php\n  At line: 198\n  Stacktrace: \n  Server info:\n   OS: FreeBSD\n   PHP Version: 5.6.33\n   Apache Version: Apache/2.4.29 (FreeBSD) PHP/5.6.33\n   DB Driver: mysql\n   DB server version: 5.1.66, referer: http://seer.fclar.unesp.br/alfa/user/registerUser
[Mon Feb 19 09:39:08.382686 2018] [:error] [pid 780] [client 200.145.66.44:2236] ojs2 has produced an error\n  Message: WARNING: file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: No such file or directory\n  In file: /usr/home/seer/public_html/lib/pkp/lib/recaptcha/recaptchalib.inc.php\n  At line: 198\n  Stacktrace: \n  Server info:\n   OS: FreeBSD\n   PHP Version: 5.6.33\n   Apache Version: Apache/2.4.29 (FreeBSD) PHP/5.6.33\n   DB Driver: mysql\n   DB server version: 5.1.66, referer: http://seer.fclar.unesp.br/alfa/user/registerUser

#2

I discovered that I did not had php-openssl installed. After this was installed the error changed to:

[Mon Feb 19 12:34:31.965183 2018] [:error] [pid 782] [client 200.145.66.44:4620] ojs2 has produced an error\n  Message: WARNING: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed\n  In file: /usr/home/seer/public_html/lib/pkp/lib/recaptcha/recaptchalib.inc.php\n  At line: 198\n  Stacktrace: \n  Server info:\n   OS: FreeBSD\n   PHP Version: 5.6.33\n   Apache Version: Apache/2.4.29 (FreeBSD) PHP/5.6.33\n   DB Driver: mysql\n   DB server version: 5.1.66, referer: http://seer.fclar.unesp.br/alfa/user/register
[Mon Feb 19 12:34:31.965277 2018] [:error] [pid 782] [client 200.145.66.44:4620] ojs2 has produced an error\n  Message: WARNING: file_get_contents(): Failed to enable crypto\n  In file: /usr/home/seer/public_html/lib/pkp/lib/recaptcha/recaptchalib.inc.php\n  At line: 198\n  Stacktrace: \n  Server info:\n   OS: FreeBSD\n   PHP Version: 5.6.33\n   Apache Version: Apache/2.4.29 (FreeBSD) PHP/5.6.33\n   DB Driver: mysql\n   DB server version: 5.1.66, referer: http://seer.fclar.unesp.br/alfa/user/register
[Mon Feb 19 12:34:31.965502 2018] [:error] [pid 782] [client 200.145.66.44:4620] ojs2 has produced an error\n  Message: WARNING: file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: operation failed\n  In file: /usr/home/seer/public_html/lib/pkp/lib/recaptcha/recaptchalib.inc.php\n  At line: 198\n  Stacktrace: \n  Server info:\n   OS: FreeBSD\n   PHP Version: 5.6.33\n   Apache Version: Apache/2.4.29 (FreeBSD) PHP/5.6.33\n   DB Driver: mysql\n   DB server version: 5.1.66, referer: http://seer.fclar.unesp.br/alfa/user/register

I have no idea on how to go on from here… :confused:


#3

I managed to fix it. It was due to my system not being able to verify the Google certificate.


#5

@luizborges How exactly did you solve the problem? We have got a similar problem.


#6

I had to point the php-openssl to the correct location of “cacert.pem”.


#7

Hi all,

I had the same error message with OJS 3.1, PHP 5.6.
After setting F_open to “on” in config.php and on the server side PHP configuration, everything worked well.

All the best,

Nicolas