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.