Connecting Tech Pros Worldwide Help | Site Map

PHP PEAR DB module not working?

mpar612
Guest
 
Posts: n/a
#1: May 1 '07
I am stumped. Below is my code and it doesn't work (I removed the
$login info for posting).

PHP Code:
require 'PEAR/DB.php';

// Connect to the database
$db = DB::connect($login);
if (DB::isError($db)) { die ("Can't connect: " . $db->getMessage()); }

// Set up automatic error handling
$db->setErrorHandling(PEAR_ERROR_DIE);

// Set up fetch mode: rows as objects
$db->setFetchMode(DB_FETCHMODE_ASSOC);

if (class_exists('DB')) {

print "ok";

} else {

print "failed";

}

However, this code does:

PHP Code:
require 'PEAR/DB.php';

if (class_exists('DB')) {

print "ok";

} else {

print "failed";

}

I just switched ISP's and none of the stuff that utilizes PEAR works
on the new ISP. PEAR is installed. The DB module is installed, but I
can't connect to a database. I don't get any errors. I just get a
blank screen.

Any thoughts would be greatly appreciated. Thanks!

Mike P2
Guest
 
Posts: n/a
#2: May 1 '07

re: PHP PEAR DB module not working?


On May 1, 9:05 am, mpar612 <mpar...@gmail.comwrote:
Quote:
I am stumped. Below is my code and it doesn't work (I removed the
$login info for posting).
>
[...]
>
I just switched ISP's and none of the stuff that utilizes PEAR works
on the new ISP. PEAR is installed. The DB module is installed, but I
can't connect to a database. I don't get any errors. I just get a
blank screen.
>
Any thoughts would be greatly appreciated. Thanks!
Where in the code does the error occur? What is the error message you
get?

mpar612
Guest
 
Posts: n/a
#3: May 2 '07

re: PHP PEAR DB module not working?


On May 1, 5:01 pm, Mike P2 <sumguyovrt...@gmail.comwrote:
Quote:
On May 1, 9:05 am, mpar612 <mpar...@gmail.comwrote:
>
Quote:
I am stumped. Below is my code and it doesn't work (I removed the
$login info for posting).
>
Quote:
[...]
>
Quote:
I just switched ISP's and none of the stuff that utilizes PEAR works
on the new ISP. PEAR is installed. The DB module is installed, but I
can't connect to a database. I don't get any errors. I just get a
blank screen.
>
Quote:
Any thoughts would be greatly appreciated. Thanks!
>
Where in the code does the error occur? What is the error message you
get?
I have come a little way since I made the post. I was originally not
getting any sort of error, but it turned out I had to put a
display_errors line in my code. Now I get the following errors:

Warning: main(): open_basedir restriction in effect. File(/usr/share/
pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/
ygptechnologies.com/httpdocs:/tmp) in /var/www/vhosts/xxxx.com/
httpdocs/PEAR/DB.php on line 30

Warning: main(PEAR.php): failed to open stream: Operation not
permitted in /var/www/vhosts/xxxx.com/httpdocs/PEAR/DB.php on line 30

Fatal error: main(): Failed opening required
'PEAR.php' (include_path='.:/usr/share/pear:/user/share/pear:') in /
var/www/vhosts/xxxx.com/httpdocs/PEAR/DB.php on line 30

I am very new to this sort of stuff and I'm really lost with what to
do. I think my first step is to modify the php.ini file.

Any assistance would be great.

Thanks in advance!

Mike P2
Guest
 
Posts: n/a
#4: May 2 '07

re: PHP PEAR DB module not working?


Warning: main(): open_basedir restriction in effect. File(/usr/share/
Quote:
pear/PEAR.php) is not within the allowed path(s): (/var/www/vhosts/
ygptechnologies.com/httpdocs:/tmp) in /var/www/vhosts/xxxx.com/
httpdocs/PEAR/DB.php on line 30
Well, this error message is a pretty good description of the problem.
Contact your new ISP and give them this message, they will be the best
ones to fix the problem.

-Mike PII

Closed Thread