I am having a serious problem connecting an external ORA DB 11g from the local Zend CE server. OCI8 is enabled and version 1.4.6 is working (due to phpinfo()
).
I tried many connection options (listed below) with the same error as when returning:
oci_connect(): ORA-28547: connection to server failed, probable Oracle Net admin error
After googling for the whole day, I can only say that this error means that PHP was able to communicate with the server, but could not connect to a specific service / database and that the error should not come from PHP itself ...
I set the TNS_ADMIN
environment TNS_ADMIN
to c:\oracle_instantclient_11_2
, where the tnsnames.ora
file containing this connection description is located:
MYDB = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = XXXX)(PORT = 1521)) ) (CONNECT_DATA = (SID = MYDB)(SERVER = DEDICATED)) )
Using this description, for example
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXX)(PORT=1521)))(CONNECT_DATA=(SID=MYDB)(SERVER=DEDICATED)))
I can connect to server and service / database using sqlplus
console, so the connection is very correct. I also use the same HOST, PORT and SID to connect to the server using the Sqldeveloper
tool. The problem is connecting to the server in PHP ...
What I have tried so far:
oci_connect("user", "password", "XXXX:1521", "AL32UTF8", 0); oci_connect("user", "password", "MYDB", "AL32UTF8", 0); oci_connect("user", "password", "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXX)(PORT=1521)))(CONNECT_DATA=(SID=MYDB)(SERVER=DEDICATED)))", "AL32UTF8", 0);
All oci_connect
calls listed above return the same error.
I also tried the ezconnect
method for 11g, as stated here - [//]host_name[:port][/service_name][:server_type][/instance_name]
:
oci_connect("user", "password", "XXXX:1521/MYDB", "AL32UTF8", 0);
but the problem is that I don’t know the service name
, only the service ID
( SID
), so the error returned is this:
oci_connect(): ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
which says that there is no service working with the specified service name (or that the ORA listener does not know about such a service).
PHP Version: 5.3.14
Appache v.: 2.2.22 (32bit) Zend
Zend CE Server: 5.3.6
PHP information for OCI8:
OCI8 Support enabled Version 1.4.6 Revision $Revision: 313688 $ Active Persistent Connections 0 Active Connections 0 Oracle Instant Client Version Unknown Temporary Lob support enabled Collections support enabled Directive Local Value Master Value oci8.connection_class no value no value oci8.default_prefetch 100 100 oci8.events Off Off oci8.max_persistent -1 -1 oci8.old_oci_close_semantics Off Off oci8.persistent_timeout -1 -1 oci8.ping_interval 60 60 oci8.privileged_connect Off Off oci8.statement_cache_size 20 20
Perhaps the problem is that there is a version of unknown
Oracle instant client
, although the path is specified in the TNS_ADMIN
and PATH
environment TNS_ADMIN
...
My question is: Does anyone know what I did wrong? Am I missing something? I have googled all day yesterday, so probably (with a 99% chance) any google links that you would like to provide to me, I already saw and tried ...
Although this question can be regarded as an exact duplicate of this , it has not yet been answered, and I think that no one will return to this old question, even if I post a comment. I also have connection problems. Also keep in mind that in this similar question another error is returned and requested.