简体   繁体   English

ORA-12154 PHP OCI8悲伤

[英]ORA-12154 PHP OCI8 grief

Configured a CentOS 5.6 server with Oracle's 11g XE (the freebie version), installed OCI8 with the help of this guide and got a pre-existing (custom) PHP application communicating with the database with no issues. 使用Oracle的11g XE(免费版本)配置了CentOS 5.6服务器,在本指南的帮助下安装了OCI8,并获得了一个与数据库进行通信的现有(自定义)PHP应用程序,而没有出现任何问题。 Called that server Dev and started the next build. 将该服务器称为Dev,并开始下一个构建。

The Prod server that I'm now working on is just like Dev except that Oracle 11G is the Standard edition, not the free version. 我现在正在使用的Prod服务器与Dev相似,但是Oracle 11G是标准版,而不是免费版。 Everything else, to the very best of my knowledge, identical. 就我所知,其他所有内容都是相同的。 Definitely the same OCI RPMs. 绝对相同的OCI RPM。

Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/html/blah/blah.php 警告:ocilogon()[function.ocilogon]:ORA-12154:TNS:无法解析在/var/www/html/blah/blah.php中指定的连接标识符

I'm sure I have an "environmental" issue but I can't figure out how to solve it. 我确定我有一个“环境”问题,但我不知道该如何解决。

Oracle, Apache, OCI8 and PHP are all on the same box. Oracle,Apache,OCI8和PHP都在同一盒子上。

What works: 什么有效:

  • tnsping orcl from the Prod server. 从Prod服务器tnsping orcl
  • sqlplus user@orcl from the Prod server. 来自Prod服务器的sqlplus user@orcl
  • phpconfig(); shows all the OCI8 stuff. 显示所有OCI8内容。 Compared the results on Dev and Prod and they are identical. 比较了Dev和Prod的结果,它们是相同的。
  • I can also connect via Toad from an XP client on the other end of a VPN. 我也可以从VPN另一端的XP客户端通过Toad连接。

I just can not get PHP to talk to the DB. 我只是无法让PHP与数据库对话。 Driving me mad! 让我生气!

Did a global search on the Prod server, there is only one tnsnames.ora file. 在Prod服务器上进行全局搜索后,只有一个tnsnames.ora文件。 Here's what it looks like: 看起来是这样的:

ORCL = (DESCRIPTION = ORCL =(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) (地址=(协议= TCP)(主机= localhost.localdomain)(端口= 1521))
(CONNECT_DATA = (CONNECT_DATA =
(SERVER = DEDICATED) (SERVICE_NAME = orcl) (服务器=专用)(SERVICE_NAME = orcl)
) ) ))

Anything I should provide that would help? 我应该提供什么帮助吗? Just leave a comment. 请发表评论。

I really don't want to flatten and start over on the Prod box... Please help me figure this out! 真的不想展平并重新开始Prod框...请帮我弄清楚!

[edits] [编辑]
It isn't finding the listener, I guess. 我想这没有找到听众。 Out of curiosity, I stopped the listener service and confirmed that nothing about the error changes. 出于好奇,我停止了侦听器服务,并确认该错误没有任何改变。

By request, here's some code. 根据要求,下面是一些代码。

The code that throws the error I mentioned above: 引发我上面提到的错误的代码:

$dbh = OCILogon($vars[oracle_login], $vars[oracle_pwd], $vars[oracle_instance]);

Variables are set in another file: 变量在另一个文件中设置:

... ...

But we can skip that. 但是我们可以跳过。 While copying and pasting them over to here I took a moment to line up parentheses -- and found an extra. 在将它们复制并粘贴到此处的过程中,我花了一些时间在括号中对齐-并找到了一个额外的内容。

Typo! 错别字!

Doh. h /facepalm. / facepalm。

While fulfilling a request to show some code, I took a moment to format it and line it all up. 在满足显示一些代码的请求的同时,我花了一些时间格式化并排列所有代码。 At that point, I discovered an extra parentheses. 那时,我发现了一个额外的括号。

Fixing that fixed the issue. 解决该问题的方法已解决。

Sorry for all the reading! 对不起,所有阅读!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM