环境:windows XP ;wamp(php5)
- 在命行下到php目录下,运行go-pear.bat(其内容其实为cliphp.exe -d output_buffering=0 PEARgo-pear.php )它会给你安装pear命令和安装一些pear包,此包内不含db模块;
- 找到pear.exe Command console下运行:pear install db,这时候要保证联网
- Php的配置文件中:找到include_path,增加包含db.php的路径include_path = ".;c:/php/includes;D:/wamp/php/PEAR"
- 重新启动apach服务,ok
- Test:在www目录下新建一个test.php文件,内容如下:
require_once "DB.php";
//数据库连接
$dsn = 'mysql://root:@localhost/test;
$db = & DB::connect($dsn);
if (PEAR::isError($db)) {
die($db->getMessage());
}
?>