WSOD with Cannot redeclare class OAuthException in drupal6/sites/all/modules/oauth/oauth.lib.php on line 17, referer: in apache2 error logs.

Not certain what the issue is or if this method is required for something else, but commenting out the OAuthException class from line 14 to 17 fixed the issue and got the twitter OAuth working as well.

* Generic exception class
class OAuthException extends Exception {
// pass


voxpelli’s picture

Status: Active » Postponed (maintainer needs more info)

Since this module has worked for most people there has to be something specific with your installation that makes this break.

Are you using any other OAuth-related modules that might contain OAuthException in them?

SpiesInOrbit’s picture

I don't have that class declaration any where else in my code. The only place I find it is in oauth/oauth.lib.php

voxpelli’s picture

Then I guess someone is including our file twice - can that be correct? It should only be included using require_once() or include_once()

AndyThornton’s picture

I am getting this problem too.

Fatal error: Cannot redeclare class OAuthException in /home/mfcnyorg/public_html/sites/all/modules/oauth/oauth.lib.php on line 17

I installed OAuth to get the twitter module to work again (it has been broken since twitter forced use to use OAuth). That would suggest to me that I dont have another module that would be including the library. I thought maybe it was something in my PHP environment - i am using a shared hosting account with bluehost, but what is weird is that I have another bluehost shared account for a different site and it works fine. Both are using the same version of OAuth and twitter module.

voxpelli’s picture

First: If you update with more info please change the status of an issue to active so that people will notice it

Regarding the problem: Open up your entire site's code base and search for "OAuthException" in it and see if any other file than the sites/all/modules/oauth/oauth.lib.php contains it.

All modules are free to not use this module for their OAuth purposes and to include conflicting code in their own modules instead - so you might have the OAuthExpection class elsewhere. The Twitter module has chosen to use this module to among other things avoid such conflicts.

As you confirm yourself - it works well on most installations so I will leave the status as needing more info. Once you find the module that contains the conflicting code - open an issue and see if it might be possible for them to use the OAuth module instead.

AndyThornton’s picture

Status: Postponed (maintainer needs more info) » Active

friendconnect was the module is conflict (

i've opened an issue ( may not be fixed easily, though as it comes from a library they use.

SpiesInOrbit’s picture

grepped my entire drupal code base with the following:

egrep 'class OAuthException' * -ir

Found nothing. Could it be autoloaded somewhere?

mrfelton’s picture

I have this issue with the modules installed.

Issue logged here:

voxpelli’s picture

@mrfelton: I think Gigya includes a library similar to the OAuth module which results in a conflict. Gigya could avoid this by supporting the OAuth module.

voxpelli’s picture

Status: Active » Closed (won't fix)

As these errors seems to be caused by other modules I'm closing this as a won't fix.

hansait’s picture

We resolved the "Fatal error: Cannot redeclare class OAuthException" error by disabling OAuth in our php installation.

liza’s picture

same problem here. dont have OAuth anywhere other than on a subdirectory installation of StatusNet

yngens’s picture

This error started to happen on my site since last update of Twitter module to recommended version 6.x-3.0-beta9

Fatal error: Cannot redeclare class OAuthException in /sites/all/modules/oauth/oauth.lib.php on line 17

ErikWegner’s picture

I had this issue, too. It was because I updated from 2.02 to 3.0b4 without removing the module directory, instead I just put all files into the existing directory. After deleting the oauth directory and placing a fresh version, the error is gone.

venusrising’s picture

Status: Closed (won't fix) » Active

Fatal error: Cannot redeclare class OAuthException in /home/OURSITE/html/sites/all/modules/oauth/lib/OAuth.php on line 8

Does anyone know how this may be fixed we are confused. I know twitter uses ouath

Cyberwlf’s picture

Post removed, resolved my issue with this!

Frans’s picture

Status: Active » Closed (duplicate)

This is caused by the PECL extension of PHP see #1439254: Fatal Conflicts with PHPs OAuth extension

ianims’s picture

I found this error to be due to the following:

OAuth 6.x-3.0-beta4 Provides OAuth functionality
Depends on: Autoload (enabled)
Required by: OAuth Provider UI (disabled), Twitter actions (enabled), Twitter Post (enabled), Twitter Signin (enabled)

OAuth Provider UI 6.x-3.0-beta4 Provides a UI for when OAuth is acting as a provider.
Depends on: OAuth (enabled), Autoload (enabled)

In modules->Oauth in my version there are two checkboxes, the second one (OAuth Provider UI) when
unchecked solved this problem for me