RE: [PEAR] RE: Problem connecting to database.

From: Date: Tue, 02 Jul 2002 16:50:06 +0000
Subject: RE: [PEAR] RE: Problem connecting to database.
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1793@lists.php.net to get a copy of this message
Solution: For some reason my web host doesn't have /usr/share/pear/ in their php.ini include path so I added it in my script like so: ini_set('include_path',ini_get('include_path') . ':/usr/share/pear/'); require_once('DB.php'); All fixed! Thank you for your help everyone. -----Original Message----- From: Sean Chambers Sent: Tuesday, July 02, 2002 12:31 PM To: Tomas V.V.Cox; pear-general@lists.php.net Subject: [PEAR] RE: Problem connecting to database. Yeap you were right: Warning: Failed opening 'DB/mysql.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/cust1/usr1026/html/inc/DB.php on line 250 [db_error: message="DB Error: not found" code=-4 mode=return level=notice prefix="" info=""] How would I go about placing this file in the same directory that I have DB.php and PEAR.php and then making PEAR DB find the correct path to that file? -----Original Message----- From: Tomas V.V.Cox [mailto:cox@idecnet.com] Sent: Tuesday, July 02, 2002 11:29 AM To: Sean Chambers Cc: pear-general@lists.php.net Subject: Re: Problem connecting to database. Sean Chambers wrote: > > Here is what I get: > > [db_error: message="DB Error: not found" code=-4 mode=return > level=notice prefix="" info=""] > > Doesn't make much sense to me. It's true, no sense :), I've changed it in CVS. Your problem is probably that DB can't include the file 'DB/mysql.php'. Check either the DSN you passed (specially the $db_type var) and your include path. To see the PHP native error message use: $db = DB::connect($dsn, array('debug' => 2)); > By the way, thank you for the very informative pear tutorial. I use it > as a reference on a regular basis! Thanks, some day I'll get the time to enhance it :). By the way check the DB part of the pear manual (http://pear.php.net/manual/) too. Tomas V.V.Cox > -----Original Message----- > From: Tomas V.V.Cox [mailto:cox@idecnet.com] > Sent: Tuesday, July 02, 2002 10:58 AM > To: Sean Chambers > Subject: Re: Problem connecting to database. > > Sean Chambers wrote: > > > > System stats: > > MySQL with PHP 4.1 on redhat 7.2 > > PHP is running as cgi; not as an apache module > > > > Here is the problem I am having: > > I can connect fine using the following: > > $conn = mysql_connect($db_host,$db_user,$db_pass); > > if (!$conn) { > > echo mysql_error(); > > } > > > > But when I attempt to do the following it tells me: DB Error: not > > found > > > > $dsn = $db_type.'://'.$db_user.':'.$db_pass.'@'. $db_host > > .'/'.$db_name; $db = DB::Connect($dsn); if (DB::isError($db)) { > > die ($db->getMessage()); > ^^^^^^^^^^^^^^^^^ > Change that with $db->toString() and read the error message. > > > } > > $db->setFetchMode(DB_FETCHMODE_ASSOC); > > > > Tomas V.V.Cox -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#1793) next »