Why does PEAR DB give "DB Error: extension not found [DB Error: extension not found].."
I'm moving a small set of PHP/Postgres applications from Ubuntu 9.x to 10.10. When I try to run the application, I get this error:
DB Error: extension not found [DB Error: extension not found] ** pgsql://jean@/appx
The code is:
require_once('DB.php');
$db=DB::connect("pgsql://jean@/appx");
if (PEAR::isError($db)) {
die($db->getMessage()." ".$db->getUserInfo()." ");
}
if (DB::isError($db)){
die($db->getMessage());
}
When I installed DB, I noticed that it's been supersceded by MDB2, what do I have to change to make it work with MDB2, or what do I need to do make the DB code work?
Thanks.
Jean
PHP
Last Comment
Julian Matz
8/22/2022 - Mon
Julian Matz
Hi JPNeron,
See if the following works for you:
$ sudo aptitude install php5-psql
(Inside a terminal window, of course)
JPNeron
ASKER
When I used 'php5-psql' as the package name, it said there was no such package. On a hunch, I tried 'php5-pgsql' instead, and it did download & install it, but I still get the error.
Julian Matz
Sorry, it's more likely you're missing the Pear extension. My guess is that when you upgraded, the php extension directory probably changed. If this is the case, you'll need to reinstall the DB package. However, what I would do is try the MBD2 package first. If that fails, just re-install DB.
$ pear install MDB2
Make sure there are no errors, and take note of whether Pear has enabled the extension for you or not. You can post the last couple of lines from the output here.
Your help has saved me hundreds of hours of internet surfing.
fblack61
JPNeron
ASKER
Both those packages appear to be installed:
root@Ubuntu:/home/jean# pear install MDB2
pear/MDB2 is already installed and is the same as the released version 2.4.1
install failed
root@Ubuntu:/home/jean# pear install DB
pear/DB is already installed and is the same as the released version 1.7.13
install failed
If DB was missing, wouldn't I get an error on the require_once('DB.php') statement?
Also, just to clarify, I'm not upgrading a machine, I have a brand new machine and I copied the php pages from the old server to the new server.
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
MDB2 Error: connect failed _doConnect: [Error message: unable to establish a connection] ** pgsql(pgsql)://jean:xxx@/appx
Not sure what the problem is here. This user can run psql, access the 'appx' database, view tables, etc, etc. Maybe there's a problem in the postgres setup that prevents connections from apache?
Julian Matz
Would you be able to temporarily switch back to DB? It seems to me that DB does error reporting more constructively than MDB2, by default anyway.
Perhaps there's a setting to make MDB2 spit out more details, but I'm not sure where to look for that. But if we can get it working with DB, we should then be able to get it working with MDB2 also.
See if the following works for you:
$ sudo aptitude install php5-psql
(Inside a terminal window, of course)