php Codeigniter 和 oracle 未定义常量:OCI_COMMIT_ON_SUCCESS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6758328/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:10:08  来源:igfitidea点击:

Codeigniter and oracle undefined constant: OCI_COMMIT_ON_SUCCESS

phporaclecodeigniter

提问by Lasticoteur

I develloping a web-based application with codeigniter and when I try to connect to my oracle entreprise 9g database the framework send me this error:

我使用 codeigniter 开发了一个基于 Web 的应用程序,当我尝试连接到我的 oracle entreprise 9g 数据库时,框架向我发送了这个错误:

    A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS'

Filename: database/DB.php

Line Number: 142

I tried different method to connect (classic, oracle specific). There is my config/database.php file.

我尝试了不同的连接方法(经典的,特定oracle 的)。有我的 config/database.php 文件。

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=*xxx.xxx.xxx.xxx*)(PORT=1521))(CONNECT_DATA=(SID=*DB_NAME*)))';
$db['default']['username'] = '*username*';
$db['default']['password'] = '*password*';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'oci8';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I think it's not a connection error, can you help me?

我认为这不是连接错误,你能帮我吗?

回答by cwallenpoole

OCI_COMMIT_ON_SUCCESSis a constant declared in the Oracle PHP extension. Are you sure you have that installed correctly? Is it enabled in php.ini? Can you confirm that you can connect to the database manually with oci_connect?

OCI_COMMIT_ON_SUCCESS是在 Oracle PHP扩展中声明的常量。你确定你安装正确了吗?它是否在 php.ini 中启用?你能确认你可以手动连接到数据库oci_connect吗?

If you don't have the extension, then you'll need to install it. There is a list of steps I generally take to debug the installation here.

如果您没有扩展程序,则需要安装它。此处列出了我通常用于调试安装的步骤列表。

I'm not sure what the value of OCI_COMMIT_ON_SUCCESS is, but you might be able to fake it with your own define, if it comes to that.

我不确定 OCI_COMMIT_ON_SUCCESS 的值是什么,但是如果涉及到这个,您可能可以用自己的定义来伪造它。