Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中“获取”;类别';PDO';“未找到”;尝试连接到Oracle数据库时出错_Php_Oracle_Pdo - Fatal编程技术网

在PHP中“获取”;类别';PDO';“未找到”;尝试连接到Oracle数据库时出错

在PHP中“获取”;类别';PDO';“未找到”;尝试连接到Oracle数据库时出错,php,oracle,pdo,Php,Oracle,Pdo,我正在尝试使用PDO连接到oracle数据库,但遇到类PDO not found error。我已检查PDO是否已启用,并且它似乎已启用。我仍然无法追踪我为什么会出现这个错误。这是我的configure命令 cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--

我正在尝试使用PDO连接到oracle数据库,但遇到类PDO not found error。我已检查PDO是否已启用,并且它似乎已启用。我仍然无法追踪我为什么会出现这个错误。这是我的configure命令

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

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

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

我犯这个错误还有其他原因吗?感谢您的帮助。

这通常意味着所讨论的PDO扩展没有经过编译和设置,因此PHP可以使用它。您在什么操作系统上编译PHP

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

您应该查阅PHP手册,了解如何安装和启用PDO模块

您应该查看以下网站:

检查我的问题我排除了这个错误和其他错误,但是我卡住了,

agiletoolkit config-default.php文件中的Oracle连接字符串如下所示:

$config['dsn']= array( 'oci:dbname=localhost/MYDATABASE', 'MYUSER', 'MYPASSWORD' );
class DB_dsql_oci extends DB_dsql {
    function limit($cnt,$shift=0){
        $cnt+=$shift;

    $this->where('NUM_ROWS>=',$shift);
        $this->where('NUM_ROWS<',$cnt);
        return $this;
    }
    function render_limit(){
        return '';
    }
}
为了修复未找到驱动程序错误,我在apache安装的php.ini文件中启用了extension=php_pdo_oci8.dll

然后出现了一个关于缺少“oci.php”的错误,要解决这个问题,我必须创建自己的文件,如下所示:

$config['dsn']= array( 'oci:dbname=localhost/MYDATABASE', 'MYUSER', 'MYPASSWORD' );
class DB_dsql_oci extends DB_dsql {
    function limit($cnt,$shift=0){
        $cnt+=$shift;

    $this->where('NUM_ROWS>=',$shift);
        $this->where('NUM_ROWS<',$cnt);
        return $this;
    }
    function render_limit(){
        return '';
    }
}
类DB\u dsql\u oci扩展了DB\u dsql{
功能限制($cnt,$shift=0){
$cnt+=$shift;
$this->where('NUM_ROWS>=',$shift);

$this->where('NUM_rowspo需要启用通用PDO模块和特定于驱动程序的模块(在您的例子中是php_oracle)。在PDO部分“PDO驱动程序”中调用phpinfo()输出什么?启用了哪些特定驱动程序?既然您提到了这一点,我在phpinfo()中再次签出,但没有“PDO驱动程序”部分.啊,是的,当然,我想这是有道理的,因为你提到没有找到类PDO。我真傻。恐怕我对配置PHP的方式没有太多经验。但我想你应该有另一个配置选项,类似于安装通用PDO模块的“--with PDO”。这是假设“--with PDO oci”没有“我不能自动安装通用PDO模块。但对此不确定。@fireeyedboy:你应该在回答中发布,而不是评论。我(实际上,我的网站管理员)是在Windows Box上编译的。我想他没有安装PDO_OCI,但已经解决了。谢谢。”。