PHP + ORACLE连接问题

时间:2011-07-05 07:14:30

标签: php oracle

我的错误代码是:

Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /data01/app/htdocs/doosanclub/include/classes.pinc on line 47

,第47行是:

46:     function connect($DBuser,$DBpassword,$DBsid) {
47:        $this->conn = OCILogon($DBuser,$DBpassword,$DBsid);
48:        $this->mode = OCI_DEFAULT;
49:    }

我的ORACLE_HOME在root.sh中设置:ORACLE_HOME=/oracle

/oracle是包含/bin的正确目录。

和..我的$ DBsid值也在/oracle/network/admin/tnsnames.ora中定义。

我用Google搜索了一些docs并试了一下。我做了一个测试php文件。 代码是:

oci_internal_debug(1);   // turn on tracing
$conn = oci_connect("id", "pw", "SID");

并显示:

OCI8 DEBUG: OCINlsEnvironmentVariableGet at (/temp/php_source/php-5.2.13/ext/oci8/oci8.c:1067) OCI8 DEBUG: OCIEnvNlsCreate at (/temp/php_source/php-5.2.13/ext/oci8/oci8.c:1223) 
Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in /data01/app/htdocs/doosanclub/db_connect_test.php on line 23
OCI8 DEBUG: OCIHandleFree at (/temp/php_source/php-5.2.13/ext/oci8/oci8.c:1547) 
再次

ORACLE_HOME ..也许这是错的..?我不知道..

这是第一次设置这些东西。 请帮我解决这个问题。谢谢!

1 个答案:

答案 0 :(得分:0)

我只是通过将putenv()添加到连接PHP文件的数据库中解决了这个问题。

putenv("ORACLE_HOME=/oracle");

但在设置phpinfo();之前,ORACLE_HOME=/oracle显示ORACLE_HOME非常奇怪。

相关问题