MediaWiki OpenID Extension

After working to install version 0.7.0 of the MediaWiki OpenID extension, it turns out that the whole thing boils down to 7 pretty darn simple steps. Although the OpenID extension README says the extension was “tested with 2.0.0 rc2” (of the php-openid library), the plugin doesn’t actually work with php-openid-2.0.0.  For some reason, I feel chicken about clarifying this point on the actual extension wiki site – perhaps if somebody externally validates my findings and comments here, I’d feel better about it…

  1. Download/check out the extension and place it in the extensions directory as extensions/OpenID.
  2. Create the user_openid table from the .sql file included in the OpenID directory:
      mysql <dbname> -u <username> -h <hostname> -p < openid_table.sql
  3. Create an includes directory within the extensions subdirectory (this is where I put it – if you want it somewhere else, just make sure that it is a place that won’t be overwritten or deleted during upgrades, and alter the path in step 6 accordingly).
      mkdir extensions/includes
  4. Download version 1.2.3 of the PHP-OpenID library and place it in extensions/includes.
  5. Run the detect.php script inside of extensions/includes/php-openid-1.2.3/examples and do your best to deal with what it says. If you are missing things like MySQL and PEAR, you’ll just have to figure that out yourself, sorry. If, however, the results of the detect.php script tell you that you have no big integer math support as shown below, you should uncomment the define command in the code you paste into LocalSettings.php in step 6:
  6. Your PHP installation does not include big integer math support. This
    support is required if you wish to run a secure OpenID server without using
    SSL..

  7. Add the following lines to LocalSettings.php (remember to uncomment the NO_MATH_SUPPORT line if you received the error shown in step 5):
  8. #
    # -- OpenID Extension
    #
    $path = "$IP/extensions/includes/php-openid-1.2.3";
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    # -- uncomment the following line if you have no big integer math support!
    #define("Auth_OpenID_NO_MATH_SUPPORT", true);
    require_once("$IP/extensions/OpenID/OpenID.php");

  9. Attempt to log into your site with an OpenID – hopefully it works!
  10. Update:  if you have issues, a reader emailed in to say that he had to add a trailing slash (“/”) to the path statement in step 6 before anything would work.  It would look like this:  $path = “$IP/extensions/includes/php-openid-1.2.3/”;  It couldn’t hurt to give that a try… (thanks Christian)

2 thoughts on “MediaWiki OpenID Extension

  1. Hey Pam,

    Greetings from Edmonton.
    I’ve decided that from now on, whenever I’m in doubt, I’m just going to ask myself WWPDD? (What would Pam Dingle Do?)

    I decided to try to install OpenID on MediaWiki and kept getting caught between the two different libraries, not to mention my general confusion. Then, I set the project aside until today, when I found your post.

    I had to do a few additional tweaks to openID_Table.sql and to LocalSettings.php, but aside from that your seven steps were fantastic. I’m going to try to post about it tomorrow, but I just needed to tell you that you rule.

  2. I actually just added php-openid’s Auth directory directly to the mediawiki directory so it’s automatically found in the local path. You may also want to fix the two header() function calls within the OpenID extension (they have two string parameters instead of one).

Comments are closed.