I am having a strange issue with Oracle and PHP. I am running PHP Version
4.3.4 on Red Hat AS 2.3 and trying to connect to Oracle 9i also on Red Hat
I compiled PHP successfully with OCI and oracle. My script uses the
ocilogon($user, $password, $db); or ora_logon($user.'@'.$db, $password);
depending on what interface I want to use in my abstraction layer.
Note: All oracle failures (*** some error ***) are when I use the ora_logon,
ocilogon, or the ocinlogon.
Info about what works:
- PHP can at lease partially talk to the remote Oracle DB.
- If I give a bad username or password, PHP returns *** Oracle: Connection
Failed: ORA-01017: invalid username/password; logon denied.*** So I know
PHP is able to validate the username against the remote Oracle database.
- If I give an unspecified TNS name, "BDB1_broken", instead of "BDB1" which
is in the tnsnames.ora file, I get the following Oracle message though PHP:
*** Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name
***. So I know that the TNS name is being verified against the remote
- When I try to logon to the remote DB with SQLPlus using the same
tnsnames.ora file used by PHP, I can logon just fine. Also, a plsql stored
procedure running off a DAD on the server works.
When I use the correct username, password and ORACLE_SID, I get the
*** Oracle: Connection Failed: ORA-12545: Connect failed because target host
or object does not exist ***
- Tried specifying the DB connection in the PHP code
$DATABASE = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521))
(SERVICE_NAME = BDB1.world)
- Tried using the IP address "192.168.2.2" and the host name both in the
PHP and the tnsnames file.
- Added apache and nobody to the oracle and the dbs groups.
- Setting different environment vars in the PHP code
- Recompiling PHP
- Using "BDB1" and "BDB1.PROD_DATABASE.MY_DOMAIN.COM" in the putenv and the
database name in the connection function.
- Checked the Apache config
export ORACLE_HOME ORACLE_BASE
export PATH LD_LIBRARY_PATH
export ORACLE_DOC ORACLE_SID TNS_ADMIN
Does anyone have any thoughts????
Thanks for any help,
AT = @
DASH = -
DOT = .