Gentoo Wiki


This article is still a Stub. You can help Gentoo-Wiki by expanding it.

Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article

To get the OpenID MediaWiki extension working.


What is OpenID?

OpenID is an open, decentralized, free framework for user-centric digital identity.

OpenID starts with the concept that anyone can identify themselves on the Internet the same way websites do-with a URI (also called a URL or web address). Since URIs are at the very core of Web architecture, they provide a solid foundation for user-centric identity.

The first piece of the OpenID framework is authentication -- how you prove ownership of a URI. Today, websites require usernames and passwords to login, which means that many people use the same password everywhere. With OpenID Authentication (see specs), your username is your URI, and your password (or other credentials) stays safely stored on your OpenID Provider (which you can run yourself, or use a third-party identity provider).

To login to an OpenID-enabled website (even one you've never been to before), just type your OpenID URI. The website will then redirect you to your OpenID Provider to login using whatever credentials it requires. Once authenticated, your OpenID provider will send you back to the website with the necessary credentials to log you in. By using Strong Authentication where needed, the OpenID Framework can be used for all types of transactions, both extending the use of pure single-sign-on as well as the sensitivity of data shared.


It is a 2 part installation. One for the extension and another for the PHP libraries

OpenID and Yadis installation

First you will have to install the OpenID and Yadis PHP libraries It depends on PHP having enabled the following:

  1. GMP extension or Bcmath extension
  2. CURL extension
  3. PEAR DB
  4. domxml PHP XML processing extension (Should be enabled by default)

Download the openid php libraries from [2] and install it with pear.

$pear install package2.xml

If there are no errors, all is well :)

Extension Installation

Now we go on to the installation of the extension.

  1. Create a folder OpenID in the MediaWiki extensions directory.
  2. Download the extension from [1] and extract it to a temporary folder.
  3. Copy the contents of the MediaWiki-OpenID-0.6 into the directory OpenID
  4. Remove all instances of ${wgDBprefix} from Consumer.php. It was a workaround for older MediaWiki versions and is not needed anymore. I will include below the feedback from the author. (Current svn, 16-jan-2006, has a fix for this)
  5. Add the below into the LocalSettings.php from MediaWiki. You will have to replace with the actual web address and /path/to/some/directory/ to.... I think you know what ;-)
# Load the OpenID extension
# Set the URL for the MediaWiki installation.
# Allow all by default
# Set the store type to file
# Set the location of where to store but not reachable by the web
# Do the same stor thing for the OpenID server

Adding a new table to wiki's database

Next we need to add a new table to the wikidb. But you have to modify the openid_table.sql if you have a table prefix.

  $ mysql -h yourdbhost -u youradminuser -p yourwikidb < openid_table.sql

That's it, now you should be able to login with your OpenID.

Below are the links the feedback and a patch to Consumer.php. Let me know if you need more info or if anything is not clear.

Feedback Author OpenID media wiki extension.

On Tue, 2006-26-12 at 00:26 +0100, Sander Sweers wrote:
> I fixed it in function OpenIDGetUser by removing ${wgDBprefix} from 
> $tableName = "${wgDBprefix}user_openid";
> This is probably not the "correct" way of fixing it but it works for me 
>  ;-)  I suspect not many use a prefix for the wikidb tables and this never 
> came up as a problem.

Adding the prefix was a workaround for older versions of MediaWiki. I
have to admit that I haven't tested the prefix functionality with later
versions (>1.6.x), so it seems like it's no longer necessary.


The OpenID extension for MediaWiki with instructions and useful info.
The PHP Yadis and OpenID libraries. The link below has a tarball with both the OpenID and Yadis libs.


--- ./Consumer.php      2006-11-30 18:35:00.000000000 -0600
+++ /var/www/localhost/htdocs/mediawiki/extensions/OpenID/Consumer.php  2006-12-27 14:36:13.000000000 -0600
@@ -426,8 +426,8 @@
        # Find the user with the given openid, if any

        function OpenIDGetUser($openid) {
-               global $wgSharedDB, $wgDBprefix;
-               $tableName = "${wgDBprefix}user_openid";
+               global $wgSharedDB;
+               $tableName = "user_openid";
                if (isset($wgSharedDB)) {
                        $tableName = "`$wgSharedDB`.$tableName";
@@ -637,9 +637,9 @@
                $openid_url = null;

                if (isset($user) && $user->getId() != 0) {
-                       global $wgSharedDB, $wgDBprefix;
+                       global $wgSharedDB;

-                       $tableName = "${wgDBprefix}user_openid";
+                       $tableName = "user_openid";
                        if (isset($wgSharedDB)) {
                                $tableName = "`${wgSharedDB}`.$tableName";
Retrieved from ""

Last modified: Fri, 05 Sep 2008 20:38:00 +0000 Hits: 5,431