douluan1533 2011-07-05 07:14
浏览 142
已采纳

PHP + ORACLE连接问题

My error code is :

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

and the line 47 is :

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

My ORACLE_HOME is set in root.sh : ORACLE_HOME=/oracle

and /oracle is a correct directory that contains /bin.

and.. my $DBsid value is also defined in /oracle/network/admin/tnsnames.ora.

I googled some docs and try it. I made a test php file. THe code is :

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

and it displays :

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 again.. maybe it is wrong..? I don't know..

It's the first time to setup these things. Please help me out this problem. Thanks!

  • 写回答

1条回答 默认 最新

  • dongmeng1875 2011-07-08 07:37
    关注

    I solved this problem just by adding putenv() into a DB connecting PHP file.

    putenv("ORACLE_HOME=/oracle");
    

    But it's very weird that phpinfo(); displays ORACLE_HOME=/oracle before I set ORACLE_HOME.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀