我们计划实施 Oracle Wallet。它从 sqlplus 工作,如下所示。这表明钱包功能正在运行。
export ORACLE_HOME=/afs/engg/g/lcls/package/oracle/product/11.1.0.6/client
export PATH=$ORACLE_HOME/bin:${PATH}
export TNS_ADMIN=/afs/engg/g/lcls/tools/oracle/wallets/engg_reader
$ sqlplus /@enggdev
SQL> show user
USER is "ENGG_READER"
到目前为止,我还没有成功使它从 php 工作。我们安装了带有 OCI8 扩展的 php。请特别指导我 oci_connect 命令及其语法。
这是我的 php 文件 -
<?php
// Create connection to Oracle
PutEnv("ORACLE_HOME=/afs/engg/g/lcls/package/oracle/product/11.1.0.6/client");
PutEnv("TNS_ADMIN=/afs/engg/g/lcls/tools/oracle/wallets/engg_reader");
$conn = oci_connect("/", "", "$TNS_ADMIN", null, OCI_CRED_EXT);
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!\n";
}
// Close the Oracle connection
oci_close($conn);
?>
当我执行命令时$ /mccelog/package/php/php-5.4.7/bin/php connect4.php
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong
with your system - please check that ORACLE_HOME and LD_LIBRARY_PATH are set and
point to the right directories in /afs/engg/u/cd/divekar/technical/connect4.php on
line 7
请注意,我已正确设置ORACLE_HOME
和LD_LIBRARY_PATH
. 第 7 行是导致该错误的 oci_connect 字符串。如何使用 oci8/oci_connect 连接到 Oracle 数据库?
提前谢谢你。问候。-Shashi Divekar