上面的问题解决了,但是函数还是运行错误 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 /usr/local/apache2/htdocs/test.php on line 4
感谢各位的帮忙,我通过修改环境变量,已经没有以上问题了,但是问题又来了 Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /usr/local/apache2/htdocs/test.php on line 3真是想哭了!
http://pecl.php.net/package/oci8
Oracle官方的技术资料
http://www.oracle.com/technology/global/cn/tech/php/index.html
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 /usr/local/apache2/htdocs/test.php on line 4
如果默认apache,
会在启动apache的时候读取一个设定文件,
[code=BatchFile]/etc/sysconfig/httpd[/code]在里面设定ORACLE_HOME路径就可以解决你的问题
[code=BatchFile]ORACLE_HOME=路径
export ORACLE_HOME[/code]
如果是自行安装的apache,可以对总体的环境参数进行设定,或者在启动脚本中设定ORACLE_HOME
。
Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /usr/local/apache2/htdocs/test.php on line 3真是想哭了!
应该是设定文件内容不全的问题,
$ORACLE_HOME/network/admin/tnsname.ora, sqlnet.ora
检查一下,先手动用sqlplus连接测试,成功之后再用PHP。
sqlplus是可以连接的,并且用sys用户登录后,可以建用户,建表空间,所有操作,都没有问题
你说的2个文件都有。
只是PHP连接的时候报错!
搞不明白的怎么回事
用你php里面设定的oracle账号连接,
而且,注意ORACLE_HOME路径的设定,必须是跟sqlplus相同的