Craig Hoffman wrote:
Hi There,
I'm trying to configure my OS X box to work with PEAR. Everything seems to be working (updating PEAR libraries, etc.) except when I run my test script I get the following error:

Fatal error: Cannot redeclare class db in /usr/lib/php/DB.php on line 271

Here is my test script:
require 'DB.php';
    if (class_exists('DB'))    {
        print 'Ok';
        } else {
                print 'Nope';

I've included the path in my PHP.INI file and I still get this error. I've tested this script on another PEAR server and it works fine.
Does anyone have any ideas? If this is wrong list, my apologies. Any help would be greatly appreciated.

Comment out the 'require' line - and run your test script. I expect you'll get the result "Ok". If so, you have something somewhere that's already including DB.php.

Are you running this test script from within something, or do you actually include some 'common libraries' (your own custom, or some frameworks?). You may also try changing it to require_once, in case something is already require'ing it.

The error is clearly stating that there's already a "class DB" defined. It's defined somewhere.

- Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital.

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to