PEAR DB w/ PHP5

software development

#1

I’ve switched over to PHP5 on one of my sites and noticed that PEAR’s DB package doesn’t seem to have been included.

Is that true? Or am I just trying to include it wrong? Currently using this method which worked fine under PHP4:
include_once(‘DB.php’);


#2

It has the default packages installed with it. Unfortunately that does not include DB.

I can’t say if they plan on including that or not.


#3

Ya this is a stupid question, but is there anything we can do to get db.php with PHP5?


#4

If the core PEAR installed (which it was), you can use DB package even it is not installed by default (this is because DB package is ‘almost’ independent to PEAR).

Just go & download DB package (http://pear.php.net/package/DB/download). Unzip the DB.php and DB folder to any directory under your website directory and include this DB.php.

So, instead of writing:

require_once(‘DB.php’);

as normal, you just change it to:

require_once(‘path/to/your/DB.php’);

and it will work.


#5

A summary of situation: if you choose to run PHP5 in Dreamhost, you will not be able to use PEAR’s DB package by default. In my last post, I said it is possible to just download the DB package and upload to your own site’s directory to use.

However, from the help of Dreamhost team, there is a better way:

just include a line before you use DB:

set_include_path(’/usr/local/lib/php’);
require_once(‘DB.php’);

and you’re ready to go.


#6

I’m still having problems. I’m trying to install a software, I’ve added this
set_include_path(’/usr/local/lib/php’);
require_once(‘DB.php’);

and it still doesn’t work…


#7

I’ve managed to get thru: you do not have to put the require_once(‘DB.php’); line.


#8

I am replying to this thread because it came up so highly in my google search and I thought others might need my solution.

To get the DB file to be found, you do need to change the set_include_path, but it needs to be changed to the path Dreamhost tells you to set in your phprc file.

This is what got mine working:
set_include_path(’/home/YOUR USERNAME HERE/pear/share/pear’);