在PHP中,“未找到类'PDO'"尝试连接到Oracle DB时出错 [英] In PHP getting "Class 'PDO' not found" error while trying to connect to Oracle DB

查看:144
本文介绍了在PHP中,“未找到类'PDO'"尝试连接到Oracle DB时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PDO连接到我的oracle数据库,但是却收到找不到类PDO错误..我已经检查了PDO是否已启用,并且显示为如此.不过,我仍然无法追踪为什么会出现此错误.这是我的配置命令,

I am trying to connect to my oracle database using PDO but I am getting Class PDO not found error. I have checked that PDO is enabled and it appears so. Still I am not able to trace why I am getting this error. Here is my configure command,

cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" 
"--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" 
"--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" 
"--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"

PHP版本:5.2.8 甲骨文:10.2

PHP ver : 5.2.8 Oracle: 10.2

这是我用来连接数据库的代码.

This is the code I am using to connect to the db.

try{
    $conn = new PDO("oci:dbname=".$oc_db,$oc_user,$oc_pass);
}catch(PDOException $e){
    echo ($e->getMessage());
}

是否还有其他原因导致我收到此错误?任何帮助表示赞赏.

Can there be any other reason that I am getting this error? Any help appreciated.

推荐答案

这通常意味着未编译和设置有问题的PDO扩展,因此PHP可以使用它.您要在什么操作系统上编译PHP?

This generally means the PDO extension in question isn't compiled and set up so PHP can use it. What operating system are you compiling PHP on?

如果仅指定编译它的oracle扩展(PDO-OCI),我不确定PDO核心模块是否已编译.

I'm not sure if PDO core module is compiled if you only specify to compile the oracle extension of it (PDO-OCI).

您应该查看有关如何安装和启用PDO模块的PHP手册.

You should check out the PHP manual regarding how to install and enable the PDO module.

您应该查看以下站点: http://is.php.net/manual/en/pdo.installation. php http://is.php.net/manual/en/ref. pdo-oci.php

You should look at these sites: http://is.php.net/manual/en/pdo.installation.php http://is.php.net/manual/en/ref.pdo-oci.php

这篇关于在PHP中,“未找到类'PDO'"尝试连接到Oracle DB时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆