recaptcha 1.8.x v1.1

Release Notes

recaptcha was not appearing for https sites - fixed this by including additional arguments in the call for recaptcha_get_html()

  • thanks a lot for latest update, now it works with Chrome/webkit browser
    and it actually block tons of spam users, thanks ! 

  • Doesnt work on Firefox 17.0.1 for Linux. No captcha image appears. Flushed caches - still nothing. elgg v1.8.6 doesnt complaint about no captcha, allows registering as if there's no captcha plugin.


    Simple 3 words : does not work.

  • Roman,

    I installed the recaptcha on 1.8.6 and it works perfectly fine - so there must be something you are missing 

    Here is what i did 

    1. Fresh install of Ubuntu 12.04 - all up to date 
    2. Fresh install of elgg 1.8.6
    3. Firefox update v 17.0.1 
    4. Installed the recaptcha plugin with recaptcha public and private keys 
    5. Tested user registration successfully

    some things i can think of are 

    1. have you got the correct public and private keys for your domain ?
    2. are you doing this on localhost ? 
    3. are you able to enter the public and private keys into the recaptcha settings ?
    4. have you tested your public and private keys on some other page ?
    5. are you using walled garden in elgg ? 


  • No, I'm using it on actual website with registered domain name. I'd used recaptcha on other CMS'es, so I know what I'm doing. when I save keys form and opening plugin settings again, no keys are present in the form fields. Does it mean they're not stored or it's intended to be so. No walled garde, but many plugins, including snow for the season feelings.


  • this plugin in 1.8.11 do not save this config in administration 

  • mariano, 

    i installed a fresh copy of Elgg 1.8.11 and everything seems to be working fine - let me know if i can help troubleshoot your problem

  • production on my site not get it to work, everything perfect on localhost

  • are you able to enter the public and private keys into the recaptcha settings ?

    that's what I fail

  • no save config in admin center this is my problem ;)

  • Hi mariano,

    I have the same  issue, Elgg 1.8.12 fresh isntalled.

    Public and Private key entered, set as Use Recaptcha for user registration.

    I received the message that the entries were stored but nothing happens.

    In the admin the fields for the keys are empty and the recaptcha does not appears in user reg form.

    Any ideas?



  • Hi,

    I suffered first trying to make this work. The stupid error returned from the reCAPTCHA lib "Could not open socket" is really not useful nor helpful! It wouldn't tell you weather you did something wrong or is it just Google's service down!

    I did some slight changes to solve this:

    I changed lines 80-82 in lib/recaptchalib.php:
            if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
                    die ('Could not open socket');
        if( false == ( $fs = fsockopen($host, $port, $errno, $errstr, 10) ) ) {
          register_error("$errstr<br/>Sorry .. reCAPTCHA service is down! Please contact the admin or try later!");
          return false;
    So, instead of die()ing it shows a resonable error message to the user.

    Also, I added some code before this:
    // If function is disabled inform the user
    if (in_array('fsockopen', explode(',', ini_get('disable_functions'))))
      register_error("fsockopen() function is disabled! Please change it in your php.ini!");
      return false;

    It's working fine and steady.

    If you'd like another solution, you can also use cUrl library instead if you have this function disabled and don't want to enable it. Please refer to this question on Stack Overflow:


    Hope this helps!

  • @Ossama Khayat,

    never had this problem and no one reported it - seems very rare and for google service to not be available, is even more rare. 

    But i think this is a good suggestion and also a best practice to code for all unknown errors. 


  • I also have this problem.

    I installd Elgg only a few days ago and have others installed where recaptcha works.
    I don't have walled installed
    Keys are  new as I assumed I couldn't use the old ons
    It's like it doesn't catch the info I type in. I am not going to open for registration before this work.

  • @Nefea,

    what elgg version are you using ? - did you say that it worked previously ?

  • I'm running Elgg 1.8.14 and no, I haven't been able to make recaptcha work in Elgg (this is my first installation of Elgg) But I have had other apps/softwares installed where recaptcha was working, never had a problem before. (More so you know that I'm familiare with recaptcha)

  • @Nefea, 

    i just tested this again wth vanilla install of elgg 1.8.16 and its works fine. It remembers the public and private keys in the settings. I do not know how you are setting it up - so its difficult for me to guess what is wrong. 

    Some things you can do are 

    • make sure the recaptcha dir has read and execute access for the web user
    • make sure that your public and private keys work for the domain ( localhost might be different )
    • check apache logs for errors

    you  can go to the table elgg_private_settings and should be able to see 2 rows with names recaptcha_public_key and recaptcha_private_key

    let me know if you need more help in troubleshooting

  • I've changed the permission for the folder and now it seems to keep the info I type in, and I also got the text "" on the registration page, but nothing else.

    I don't know anything about mysql tables but I can se that recaptcha is not in there.

  • Thank you! It works great!

Project Info


  • Category: Spam
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 2331
  • Recommendations: 10