Posted on 2009-01-16 13:54
Kevin Meng 阅读(746)
评论(0) 编辑 收藏
(1)安装php_pdo.dll和php_pdo_cio.dll,在php的安装包里面有,建议用php5.2以上版本;
(2)安装oracle 10g客户端,如果你用的是oracle 9i同样需要安装oracle 10g客户端,否则无法连接oracle。如果你的机器上已经安装有oracle 9i,安装oracle 10g客户端对oracle 9i并没有影响。
(3)重新启动机器。
(4)用phpinfo()检验是否已经加载了php_pdo和php_pdo_oci扩展
连接代码
[development]
database.config.type = pdo_oci
database.config.host=localhost
database.config.username = szapp
database.config.password = szapp
database.config.dbname = ora
database.config.port=1521
$params = array ('dbname' => $config->database->config->dbname,
'username' => $config->database->config->username,
'password' => $config->database->config->password,
'host'=>$config->database->config->host,
'port'=>$config->database->config->port );
$db = Zend_Db::factory ( $config->database->config->type, $params );
$registry->set ( 'db', $db );