How to enable reCAPTCHA V2?

I just got an e-mail from Google, informing me that I’m still using reCAPTCHA v1 on my OJS install. It indeed is reCAPTCHA v1, but my key settings on Google are set for the V2, but still nothing changes. I have even created a new key and so far it still isn’t working. I’m on OJS

How can I make OJS uses reCAPTCHA v2?


This will be available in OJS 2.4.9. If you are comfortable with Git or with manual patching, you can find the needed code here:

Thanks @ctgraham, looking at those commits it mentions OJS PR as need, what is that? Do I need to enable anything?

Can I just use the regular patch from the recommend patchs to get this, or should I generated an extra patch from those commits?

To apply this via patch before the release of 2.4.9, you will need to apply patches for both the OJS application and for the shared library (in lib/pkp) directly from GitHub:

These commits are not part of the current stable 2.4.8 release, so they are not represented in the “recommended patches” diff.

Once successfully applied, you would need to go into the plugin settings and update the settings for ReCAPTCHA v2.

I got a same problem about reChapta. Please help me to overcome this problem.

This is the registration form:

This is the result:

My config.ins.php setting:

; Whether or not to enable ReCaptcha
recaptcha = on

; Public key for reCaptcha (see
recaptcha_public_key = 6LcV9jwUAAAAAM…

; Private key for reCaptcha (see
recaptcha_private_key = 6LcV9jwUAAAAAO…

; Whether or not to use Captcha on user registration
captcha_on_register = on

Lib/pkp/classes/form/validation/ setting:

	// Request response from recaptcha api
	$requestOptions = array(
		'http' => array(
			'header' => "Content-Type: application/x-www-form-urlencoded;\r\n",
			'method' => 'POST',
			'content' => http_build_query(array(
				'secret' => $privateKey,
				'response' => $form->getData(RECAPTCHA_RESPONSE_FIELD),
				'remoteip' => $this->_userIp,

	$requestContext = stream_context_create($requestOptions);
	$response = file_get_contents(RECAPTCHA_HOST . RECAPTCHA_PATH, false, $requestContext);

Hi @Jurnal_Agroqua,

Can you confirm your server settings as below:

allow_url_fopen = On

This setting is required by this feature.


Hi @anupent,

Thank you for the fast and kind response. I set it on now but stil.


I’m not sure from your earlier message whether your have made your own changes to enable ReCAPTCHA v2, or if you have use the changes pending for OJS 2.4.9 in GitHub. What specifically did you do with respect to the code?

Edit: I see now that you are probably using OJS 3.x. Since this thread started out discussing adding ReCAPTCHA v2 to OJS 2.4.x, your problem might be better discussed on a different thread. I see you have also posted this question here:

Hi @ctgraham,
I am sorry. i just saw the title (recaptcha v2). ok. i will go forward to aother thread titling Fake user/Spam registration.

Thank you

Hi @Jurnal_Agroqua,
This is not your server setting. This is your It is ok.

You my need to ask your server manager about that setting.

Also, can you see your php error log in your server. That will help to analyze and solve the problem.