Re: Pear help

From: Date: Mon, 28 Feb 2005 17:03:54 +0000
Subject: Re: Pear help
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-38708@lists.php.net to get a copy of this message
Thanks for getting back to me... Comments below - On Feb 28, 2005, at 10:49 AM, Martin Norland wrote:
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: <?php 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. If I comment out the //require it prints my else statement 'Nope'
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. I've tried require_once and it just gives me another error:
Ok Fatal error: Class 'PEAR_Error' not found in /usr/lib/php/DB.php on line 728
The error is clearly stating that there's already a "class DB" defined. It's defined somewhere. I'm not sure if this relevant, but I have used db.php (another file) in an include statements to connect mysql for a few websites.
Cheers, -- - 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 (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#38708) next »