I've got a Debian web server running Squeeze. I will be updating in the coming months but in the meantime I'm getting an error:

Fatal error: Cannot redeclare class OAuthException in /usr/share/php/OAuth.php on line 8

The error is a result of installing a WordPress module that uses the same classes as the file at /usr/share/php/OAuth.php. In an effort to fix the issue, I tried wrapping all the classes in the file like this:

if (!class_exists('OAuthException', false)) { ... }

But after doing that I got another error:

Parse error: syntax error, unexpected T_PUBLIC in /usr/share/php/OAuth.php on line 786

I'm not a php developer and so I didn't want to mess with this anymore and so reverted all my changes.

What's the proper fix for this?


If you use this library with OAuth included in PHP you get the following error:

PHP Fatal error: Cannot redeclare class OAuthException in OAuth.php on line 8

Please wrap it like that:

if (!class_exists('OAuthException')) { 

    class OAuthException extends Exception {
          // pass


I would try to remove the files in /user/share/php, find out with apt which module these files belong to and remove them

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.