By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

PHP PEAR DB module not working?

P: n/a
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!

May 1 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On May 1, 9:05 am, mpar612 <mpar...@gmail.comwrote:
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?

May 1 '07 #2

P: n/a
On May 1, 5:01 pm, Mike P2 <sumguyovrt...@gmail.comwrote:
On May 1, 9:05 am, mpar612 <mpar...@gmail.comwrote:
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?
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!

May 2 '07 #3

P: n/a
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
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

May 2 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.