Re: DB::connect problem
| From: | Gast�n | Date: | Thu, 18 Nov 2004 13:06:03 +0000 |
| Subject: | Re: DB::connect problem | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15631@lists.php.net to get a copy of this message | ||
Thank you!! I tried including the die here line until i found the error. It
was my mistake in other part of the code result of being to much excited
with pear to think about what i was writing. Justin thanks for your help i
hope that i can retrieve it back!
Pear's cool!
Gastón Fournier
"Justin Patrin" <papercrane@gmail.com> escribió en el mensaje
news:432beae04111716474a8744ec@mail.gmail.com...
On Wed, 17 Nov 2004 21:13:34 -0300, Gastón <lkpo2004-gas@yahoo.com.ar>
wrote:
> > So you *have* tried mysql_connect(). Well, then are
> > you sure the mysql
> > DB driver is installed and in the right place? Try
> > this:
> >
> > require_once('DB/mysql.php');
>
> When I tried that, i recibed this error:
> Fatal error: Undefined class name 'db' in c:\appserv\www\PEAR.php on line
> 12
>
> The line 12 is this:
> $db = DB::connect($dsn);
> I almost try:
> $db = DB_mysql::connect($dsn);
>
I wanted you to try that to make sure the driver was in the right
place. I have no idea what's wrong now. It looks like PHP is
segfaulting as it doesn't get to the rest of the script after
DB::connect(). I have no idea where to go from here. I would suggest
drilling into DB::connect() and putting a die('died here'); call
before each line of code until you find the one that it doesn't get
past.
One other thing....try using PEAR::isError() instead of DB::isError().
> Are we closer to the problem? I've no idea! The mysql.php requires
> common.php and this last requires pear.php. The clases are there... Why
are
> them undefined?
>
> Thank you again (and sorry also, i need more practice with my english)
> I copied the important part on top because it was complicated to find your
> answer. If that is wrong on mailing lists please correct me!!
>
> Regards
>
> Gastón Fournier
>
> --- Justin Patrin <papercrane@gmail.com> escribió:
> > On Wed, 17 Nov 2004 20:23:39 -0300, Gastón
>
>
> > <lkpo2004-gas@yahoo.com.ar> wrote:
> > >
> > > > "Justin Patrin" <papercrane@gmail.com> escribió
> > en el mensaje
> > > news:432beae0411171045d3fa7d0@mail.gmail.com...
> > >
> > >
> > > > On Wed, 17 Nov 2004 11:49:50 -0300, Gastón
> > <lkpo2004-gas@yahoo.com.ar>
> > > wrote:
> > > > >
> > > > >
> > > > > > ----- Original Message -----
> > > > > > From: Justin Patrin
> > > > > > To: Gastón
> > > > > > Cc: pear-general@lists.php.net
> > > > > > Sent: Tuesday, November 16, 2004 10:42 PM
> > > > > > Subject: Re: [PEAR] DB::connect problem
> > > > > >
> > > > > >
> > > > > > On Tue, 16 Nov 2004 19:23:49 -0300, Gastón
> > > <lkpo2004-gas@yahoo.com.ar>
> > > > > wrote:
> > > > > >> Hi! I've got this code:
> > > > > >> <?php
> > > > > >> require_once 'DB.php';
> > > > > >>
> > > > > >> $user = 'aUser';
> > > > > >> $pass = 'thePass';
> > > > > >> $host = 'localhost';
> > > > > >> $db_name = 'test';
> > > > > >> $dsn =
> > "mysql://$user:$pass@$host/$db_name";
> > > > > >>
> > > > > >> echo "CONNECTING";
> > > > > >> $db = DB::connect($dsn);
> > > > > >>
> > > > > >> echo "CHECKING ERRORS";
> > > > > >> if (DB::isError($db)) {
> > > > > >> die("ERROR: ".$db->getMessage());
> > > > > >> }
> > > > > >>
> > > > > >> echo "CONNECTED";
> > > > > >> ?>
> > > > > >> But as result i've got this:
> > > > > >> CONNECTING
> > > > > >>
> > > > > >> But nothing else!! What could be the
> > problem? I've tested the
> > > pear
> > > > > >> package date and it works fine. Could be a
> > bug on DB?
> > > > > >>
> > > > > >
> > > > > > Check for a segfault in the apache log.
> > Set error reporting to
> > > E_ALL.
> > > > > > Set a PEAR error callback which die()s
> > with the error message.
> > > > > >
> > > > > > In addition, you should output the user
> > info when getting PEAR
> > > errors,
> > > > > > especially from DB.
> > > > > >
> > > > > > die($err->getMessage().'
> > '.$err->getUserInfo());
> > > > > >
> > > > > > --
> > > > > > Justin Patrin
> > > > >
> > > > > > Check for a segfault in the apache log.
> > > > > I've checked and there is no such error.
> > > >
> > > > Hmmm...that's strange.
> > > >
> > > > >
> > > > > > Set error reporting to E_ALL.
> > > > > I don't know how to do that... Could you
> > tell me what file i have to
> > > > > modify?
> > > >
> > > > Your php.ini. If you'd rather not you can also
> > do this at the start of
> > > > your script:
> > > >
> > > > error_reporting(E_ALL);
> > >
> > > I've found this line on the php.ini: (The comment
> > says that it's for
> > > reporting errors but not notices)
> > > error_reporting = E_ALL & ~E_NOTICE
> > > I've tried only with E_ALL but the error log
> > haven't changed when i run the
> > > php script
> > >
> > >
> > >
> > > >
> > > > >
> > > > > > In addition, you should output the user info
> > when getting PEAR errors,
> > > > > especially from DB.
> > > > > > die($err->getMessage().'
> > '.$err->getUserInfo());
> > > > > I've done that but nothing changed.
> > > >
> > > > I didn't think it would since you weren't
> > getting the error anyway.
> > > >
> > > > >
> > > > > Thank you Justin and excuse me for my
> > english. I don't speak it very
> > > > > good. I still don't know what the problem
> > is...
> > > > >
> > > >
> > > > Well, you're writing it ok. :-)
> > >
> > > Thank you!
> > >
> > > > Next thing is to try connecting to mysql using
> > mysql_connect() instead
> > > > of DB. See what happens then.
> > >
> > > I haven't got problems connecting with
> > mysql_connect(), but i need to
> > > connect with PEAR for work.
> > > Maybe reinstalling apache, mysql and pear it
> > works. Sometimes thats the
> > > uglyest but best solution.
> >
> > So you *have* tried mysql_connect(). Well, then are
> > you sure the mysql
> > DB driver is installed and in the right place? Try
> > this:
> >
> > require_once('DB/mysql.php');
> >
> > >
> > > >
> > > > --
> > > > Justin Patrin
> > > Thanks again, if you have another idea it will be
> > welcome (did i said it
> > > alrigth?)
> > >
> >
> > Yes, you said it fine, except for the "alright"
> > part. ;-)
> >
> > --
> > Justin Patrin
> >
--
Justin Patrin