Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description
Without real information I can only wonder and guess. Is TNS_ADMIN set to a directory or a file? It should be a directory. Try renaming sqlnet.ora temporarily or set the alias in tnsnames.ora to something like testdb.boo.com = (DESCRIPTION = ... Chris neil smith wrote: Hello chris, I've modified the variables in the apache user environment (in my case root at the moment) but that didn't amke any difference to php not being able to find tnsnames.ora. So the work around I've used is to use ORACLE_SID=desciption(...etc. SID = ))); ie the full description of the database alias within tnsnames.ora However this is not good, so if you have any other idea please let me know. I'm flumuxed. thanks, neil gt;From: Christopher Jones lt;[EMAIL PROTECTED]gt; gt;To: neil smith lt;[EMAIL PROTECTED]gt; gt;CC: php-db@lists.php.net, [EMAIL PROTECTED] gt;Subject: Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description hardcoded gt;Date: Wed, 20 Apr 2005 09:25:12 +1000 gt; gt;Make sure the environment variables are set in the shell that starts gt;Apache. See gt;http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#envvars gt; gt;Try changing your OCILogon command to gt; gt; $odbc = OCILogon(quot;yourusernamequot;,quot;yourpasswordquot;,$db); gt; gt;i.e. remove quot;/testquot; from the username parameter. gt; gt;Chris gt; gt;neil smith wrote: gt;gt;Hello, gt;gt; gt;gt;I have test script that can connect to the oracle database. It gt;gt;doesn't gt;gt;require tnsnames.ora because I define the database alias in the gt;gt;script gt;gt;itself. It looks like this: gt;gt; gt;gt; gt;gt; gt;gt;echo quot;TWO_TASK=quot;.getenv(quot;TWO_TASKquot;).quot;lt;brgt;quot;; gt;gt;echo quot;LD_LIBRARY_PATH=quot;.getenv(quot;LD_LIBRARY_PATHquot;).quot;lt;brgt;quot;; gt;gt;echo quot;ORACLE_BASE=quot;.getenv(quot;ORACLE_BASEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;ORACLE_HOME=quot;.getenv(quot;ORACLE_HOMEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;TNS_ADMIN=quot;.getenv(quot;TNS_ADMINquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;NLS_LANG=quot;.getenv(quot;NLS_LANGquot;).quot;.lt;brgt;quot;; gt;gt; gt;gt;# this allows a successful connection gt;gt; gt;gt;$db = quot; (DESCRIPTION = gt;gt; (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521)) gt;gt; (CONNECT_DATA= (SID = testdb)) gt;gt; )quot;; gt;gt; gt;gt;// these don't work.. php can't seem to find tnsnames.ora gt;gt;# $db = quot;testdb.boo.comquot;; gt;gt;//$db = quot;testdb.boo.comquot;; gt;gt;# $db = quot;testdbquot;; gt;gt;//echo $testdb; gt;gt; gt;gt; gt;gt;$odbc = OCILogon(quot;test/testquot;,quot;testquot;,$db); gt;gt; gt;gt;if ($odbc == false){ gt;gt; $msg = OCIError($odbc).quot;lt;BRgt;quot;; gt;gt;} else { gt;gt;echo quot;success!!!lt;brgt;quot;; gt;gt;} gt;gt; gt;gt; gt;gt; gt;gt;My problem is is that when I try to use the database alias in gt;gt;tnsnames.ora I gt;gt;get an ora-12154 error. I get this despite the facts that gt;gt;oracle_home, gt;gt;tns_admin and everything else is defined in the script and the gt;gt;tnsnames.ora gt;gt;contains exactly the same alias as I use in the hardcoded version gt;gt;(see the gt;gt;uncommented $db above). gt;gt;sqlnet.ora contains a value name_domain that apparently is appended gt;gt;to the gt;gt;alias in tnsnames.ora but accounting for this still doesn't let me gt;gt;connect gt;gt;to oracle . It's as if tnsnames.ora cannot be found. I've changed gt;gt;the gt;gt;permissions to 777 for the whole directory structure and I can gt;gt;successfully gt;gt;use tnsnames.ora with sqlplus or tnsping. gt;gt; gt;gt;Does anybody have any ideas what is going wrong? Is this a bug? gt;gt; gt;gt;thanks, gt;gt; gt;gt;neil gt;gt; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description
Hello chris, I've modified the variables in the apache user environment (in my case root at the moment) but that didn't amke any difference to php not being able to find tnsnames.ora. So the work around I've used is to use ORACLE_SID=desciption(...etc. SID = ))); ie the full description of the database alias within tnsnames.ora However this is not good, so if you have any other idea please let me know. I'm flumuxed. thanks, neil gt;From: Christopher Jones lt;[EMAIL PROTECTED]gt; gt;To: neil smith lt;[EMAIL PROTECTED]gt; gt;CC: php-db@lists.php.net, [EMAIL PROTECTED] gt;Subject: Re: [PHP-DB] php4 can't find tnsnames.ora oracle9 but can connectif description hardcoded gt;Date: Wed, 20 Apr 2005 09:25:12 +1000 gt; gt;Make sure the environment variables are set in the shell that starts gt;Apache. See gt;http://www.oracle.com/technology/tech/opensource/php/php_troubleshooting_faq.html#envvars gt; gt;Try changing your OCILogon command to gt; gt; $odbc = OCILogon(quot;yourusernamequot;,quot;yourpasswordquot;,$db); gt; gt;i.e. remove quot;/testquot; from the username parameter. gt; gt;Chris gt; gt;neil smith wrote: gt;gt;Hello, gt;gt; gt;gt;I have test script that can connect to the oracle database. It gt;gt;doesn't gt;gt;require tnsnames.ora because I define the database alias in the gt;gt;script gt;gt;itself. It looks like this: gt;gt; gt;gt; gt;gt; gt;gt;echo quot;TWO_TASK=quot;.getenv(quot;TWO_TASKquot;).quot;lt;brgt;quot;; gt;gt;echo quot;LD_LIBRARY_PATH=quot;.getenv(quot;LD_LIBRARY_PATHquot;).quot;lt;brgt;quot;; gt;gt;echo quot;ORACLE_BASE=quot;.getenv(quot;ORACLE_BASEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;ORACLE_HOME=quot;.getenv(quot;ORACLE_HOMEquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;TNS_ADMIN=quot;.getenv(quot;TNS_ADMINquot;).quot;lt;BRgt;quot;; gt;gt;echo quot;NLS_LANG=quot;.getenv(quot;NLS_LANGquot;).quot;.lt;brgt;quot;; gt;gt; gt;gt;# this allows a successful connection gt;gt; gt;gt;$db = quot; (DESCRIPTION = gt;gt; (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521)) gt;gt; (CONNECT_DATA= (SID = testdb)) gt;gt; )quot;; gt;gt; gt;gt;// these don't work.. php can't seem to find tnsnames.ora gt;gt;# $db = quot;testdb.boo.comquot;; gt;gt;//$db = quot;testdb.boo.comquot;; gt;gt;# $db = quot;testdbquot;; gt;gt;//echo $testdb; gt;gt; gt;gt; gt;gt;$odbc = OCILogon(quot;test/testquot;,quot;testquot;,$db); gt;gt; gt;gt;if ($odbc == false){ gt;gt; $msg = OCIError($odbc).quot;lt;BRgt;quot;; gt;gt;} else { gt;gt;echo quot;success!!!lt;brgt;quot;; gt;gt;} gt;gt; gt;gt; gt;gt; gt;gt;My problem is is that when I try to use the database alias in gt;gt;tnsnames.ora I gt;gt;get an ora-12154 error. I get this despite the facts that gt;gt;oracle_home, gt;gt;tns_admin and everything else is defined in the script and the gt;gt;tnsnames.ora gt;gt;contains exactly the same alias as I use in the hardcoded version gt;gt;(see the gt;gt;uncommented $db above). gt;gt;sqlnet.ora contains a value name_domain that apparently is appended gt;gt;to the gt;gt;alias in tnsnames.ora but accounting for this still doesn't let me gt;gt;connect gt;gt;to oracle . It's as if tnsnames.ora cannot be found. I've changed gt;gt;the gt;gt;permissions to 777 for the whole directory structure and I can gt;gt;successfully gt;gt;use tnsnames.ora with sqlplus or tnsping. gt;gt; gt;gt;Does anybody have any ideas what is going wrong? Is this a bug? gt;gt; gt;gt;thanks, gt;gt; gt;gt;neil gt;gt; gt; gt; gt;-- gt;Christopher Jones, Oracle Corporation, Australia. gt;Email: [EMAIL PROTECTED] Tel: +61 3 8616 3622 gt; gt;-- gt;PHP Database Mailing List (http://www.php.net/) gt;To unsubscribe, visit: http://www.php.net/unsub.php gt; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php