Page 1 of 1

[solved]recaptcha warning: failed to open stream, code block

Posted: Fri Aug 14, 2015 9:27 pm
by FCazabon
Hi, a client recently pointed out a error on a contact us form on their site. When the form is submitted this warning gets displayed and the form does not get submitted:

Code: Select all

Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=[removed]=[removed].223.204&v=php_1.0&response=03AHJ_V[removed]: failed to open stream: Permission denied in /home/www/pavitt.com/modules/Captcha/lib/recaptcha-php/recaptchalib.php on line 94 
I do not understand what the problem could be.

Any ideas?

Re: recaptcha warning: failed to open stream, code block

Posted: Sun Aug 16, 2015 9:02 pm
by Dr.CSS
It helps if you tell/show what versions of what you are using, it seems like you may need to go to the recaptcha home page to get new keys to use it...

Re: recaptcha warning: failed to open stream, code block

Posted: Mon Aug 17, 2015 3:30 pm
by FCazabon
Thanks, I deleted my google recaptcha key and re-created it, changed the site key and secret keys in CMSM and it has worked.

I wonder why it stopped working. Might Google have changed something?

Sorry about not posting the version details:

----------------------------------------------
Cms Version: 1.11.13
Installed Modules:
CMSMailer: 5.2.2
CMSPrinting: 1.0.5
FileManager: 1.4.5
MenuManager: 1.8.6
MicroTiny: 1.2.9
ModuleManager: 1.5.8
News: 2.15
Search: 1.7.12
ThemeManager: 1.1.8
Album: 1.10.3
FormBuilder: 0.8.1.1
Captcha: 0.5.2
Gallery: 2.0.1
CGSimpleSmarty: 1.7.4
CGExtensions: 1.45
Banners: 2.7
Showtime: 3.4

Config Information:
php_memory_limit:
process_whole_template:
max_upload_size: 10000000
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:
phpversion: 5.4.39
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 8192
memory_limit: 128M
max_execution_time: 60
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 10M
upload_max_filesize: 10M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:
Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.38
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found

----------------------------------------------

Re: recaptcha warning: failed to open stream, code block

Posted: Mon Aug 17, 2015 6:32 pm
by Dr.CSS
Maybe because it uses the newest recaptcha API...

Re: recaptcha warning: failed to open stream, code block

Posted: Tue Aug 18, 2015 1:27 pm
by Jo Morg
FCazabon wrote:I wonder why it stopped working. Might Google have changed something?
Dr.CSS wrote:Maybe because it uses the newest recaptcha API...
Yeah, as DrCSS suggested, the module has been updated to use the new reCaptcha API (which is less annoying to users, has improved useability and apparently is more effective against bots). It is mentioned on the changelog, on the help page of the module and on the forge, that one is not compatible with the other, needing new authentication keys. The old API is still supported by Google, but it is recommended to use the new one.

Re: recaptcha warning: failed to open stream, code block

Posted: Tue Aug 18, 2015 1:45 pm
by FCazabon
Thanks, but I'm still not quite understanding what happened. I didn't change anything on my site, so I guess it is that Google updated things?

Sorry for being slow on the uptake here.

Re: recaptcha warning: failed to open stream, code block

Posted: Tue Aug 18, 2015 1:58 pm
by Jo Morg
FCazabon wrote: I didn't change anything on my site, so I guess it is that Google updated things?
Someone must have upgraded Captcha to version 0.5.2. Assuming that you had previously version 0.5 or older, which were compatible with reCaptcha API 1.x, the moment you upgraded the module to 0.5.2 the reCaptcha library stopped working since the interface with the Google reCaptcha API is different for each version. You should have upgraded and generated new keys (these now for API 2.0) immediately after.

If it wasn't you who did the upgrade, someone did...

Re: recaptcha warning: failed to open stream, code block

Posted: Tue Aug 18, 2015 2:01 pm
by FCazabon
OK, thanks. Maybe I upgraded it some time ago and forgot and nobody noticed it broke anything until now.