note 15793 modified in function.oci-connect by sixd
| From: | sixd@php.net | Date: | Wed, 09 Dec 2009 21:05:55 +0000 |
| Subject: | note 15793 modified in function.oci-connect by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163762@lists.php.net to get a copy of this message | ||
For those of you who are having Oracle errors: ORA-12154 or ORA-12505 or ORA-01005 do the folowing:
The folowing precedures have been tested when connecting to a HP UX with Oracle 7.x using of couse
the OCI8 as the client interface.
Add those lines to the web server config files or set and export those ones before the web server
starts.
On Apache add these lines to httpd.conf:
SetEnv ORACLE_HOME /usr/local/oracle
SetEnv ORACLE_SID <sid>
SetEnv LD_LIBRARY_PATH /usr/local/oracle/lib
SetEnv TNS_ADMIN /usr/local/oracle/tnsnames.ora
SetEnv TWO_TASK /usr/local/oracle/tnsnames.ora
SetEnv NLS_LANG English_America.WE8ISO8859P1
SetEnv ORACLE_BASE /usr/local
When calling the OCILogon do this:
$db = " (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST =server_ip_or_dns_name)(PORT = 1521))
(CONNECT_DATA= (SID = _sid_))
)";
The previous definition is a copy of the service definition that is stored in the tnsnames.ora file.
Next, call the OCILogon function using the folowing format:
OCILogon("user/password","password", $db);
To avoid ORA-01005 error, set the NLS_LANG environment variable to English_America.WE8ISO8859P1 (
some other values may work...but we have found that this one works for us )
To avoid ORA-12154 and ORA-12505, use the service definition as the OCILogon third parameter.
I'd like to thanks to a friend of mine a.k.a Rosa for the user/password tip.
Regards
Miguel Carvalho
--was--
For those of you who are having Oracle errors: ORA-12154 or ORA-12505 or ORA-01005 do the folowing:
The folowing precedures have been tested when connecting to a HP UX with Oracle 7.x using of couse
the OCI8 as the client interface.
Add those lines to the web server config files or set and export those ones before the web server
starts.
On Apache add these lines to httpd.conf:
SetEnv ORACLE_HOME /usr/local/oracle
SetEnv ORACLE_SID <sid>
SetEnv LD_LIBRARY_PATH /usr/local/oracle/lib
SetEnv TNS_ADMIN /usr/local/oracle/tnsnames.ora
SetEnv TWO_TASK /usr/local/oracle/tnsnames.ora
SetEnv NLS_LANG English_America.WE8ISO8859P1
SetEnv ORACLE_BASE /usr/local
When calling the OCILogon do this:
$db = " (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST =server_ip_or_dns_name)(PORT = 1521))
(CONNECT_DATA= (SID = _sid_))
)";
The previous definition is a copy of the service definition that is stored in the tnsnames.ora file.
Next, call the OCILogon function using the folowing format:
OCILogon("user/password","password", $db);
To avoid ORA-01005 error, set the NLS_LANG environment variable to English_America.WE8ISO8859P1 (
some other values may work...but we have found that this one works for us )
To avoid ORA-12154 and ORA-12505, use the service definition as the OCILogon third parameter.
I'd like to thanks to a friend of mine a.k.a Rosa for the user/password tip.
Regards
Miguel Carvalho
http://php.net/manual/en/function.oci-connect.php