1

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. Called that server Dev and started the next build.

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. Everything else, to the very best of my knowledge, identical. Definitely the same OCI RPMs.

Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /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.

What works:

  • tnsping orcl from the Prod server.
  • sqlplus user@orcl from the Prod server.
  • phpconfig(); shows all the OCI8 stuff. Compared the results on Dev and Prod and they are identical.
  • I can also connect via Toad from an XP client on the other end of a VPN.

I just can not get PHP to talk to the DB. Driving me mad!

Did a global search on the Prod server, there is only one tnsnames.ora file. Here's what it looks like:

ORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED) (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!

[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. /facepalm.

Chris K
  • 226
  • 2
  • 11
  • Can you show what exactly is passed to `ocilogon()` in blah.php? – Narf Dec 07 '11 at 08:05
  • Have a look at http://stackoverflow.com/questions/7957955/ora-12154-could-not-resolve-the-connect-identifier-specified/7960036#7960036 - see if you get any further. Almost certainly an environment issue if you can connect from other places. – Stephen ODonnell Dec 07 '11 at 14:09
  • so was "typo!" the answer? might be best to put that in a answer so the question can be seen as answered – araqnid Dec 07 '11 at 14:12

1 Answers1

0

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!

Chris K
  • 226
  • 2
  • 11