Re: Oracle/PHP Issue
| From: | Justin Patrin | Date: | Thu, 04 Dec 2003 22:23:16 +0000 |
| Subject: | Re: Oracle/PHP Issue | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31905@lists.php.net to get a copy of this message | ||
I'm using the descriptor type of connection and it looks a bit different than yours. Try changing your CONNECT_DATA setion to:
(CONNECT_DATA = (SID = BDB1) (GLOBAL_NAME = BDB1.world))
Paul Miller wrote:
Hello, 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 AS 2.3. 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 database. - 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. THE PROBLEM: When I use the correct username, password and ORACLE_SID, I get the following error: *** Oracle: Connection Failed: ORA-12545: Connect failed because target host or object does not exist *** I have: - Tried specifying the DB connection in the PHP code$DATABASE = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.2)(PORT = 1521)) ) (CONNECT_DATA = (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 codeputenv("ORACLE_HOME=/opt/ora9/product/9201"); putenv("ORACLE_SID=BDB1")- 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##ORACLE ENVIRONMENT ORACLE_HOME=/opt/ora9/product/9201 ORACLE_BASE=/opt/ora9/ export ORACLE_HOME ORACLE_BASE ORACLE_TERM=vt100 LD_LIBRARY_PATH=$ORACLE_HOME/lib PATH=$ORACLE_HOME/bin:$PATH export PATH LD_LIBRARY_PATH ORACLE_DOC=$ORACLE_BASE/doc ORACLE_SID=BDB1 TNS_ADMIN=/opt/ora9/product/9201/network/admin export ORACLE_DOC ORACLE_SID TNS_ADMINDoes anyone have any thoughts???? Thanks for any help, Paul ___________________________ Paul Miller System-Wise pmillerATsystemDASHwiseDOTcom AT = @ DASH = - DOT = .