Hello, there is a need to connect to the Oracle database on a remote, from PHP, to read the data. Before that, I never worked with Oracle, therefore, digging in examples from the Internet, I try to connect as it is, but it does not work. PHP code that I execute:

$conn = oci_connect('username', 'password', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521))) (SDU=5844) (CONNECT_DATA=(SERVICE_NAME = XE)))'); if (!$conn) { $e = oci_error();exit($e['message']); } else echo 'ok'; 

Where: username is the user name, password is the password 0.0.0.0 is the IP address of the remote server (the real name, password and IP are naturally different).

As a result, I get this error

ORA-12541: TNS: no listener

On the server where PHP runs as the OS is Linux, the Oracle Instant Client is installed as the client. Who can tell what could be the problem, and where I made a mistake when connecting to the database, and how can I test the connection to a remote server?

  • It seems that the client with the server on different ports work. - Anton Reshin
  • We are only interested in the port on the database server? This is 1521A about which port on the client you are talking about? Although I didn’t try to figure it out with my partner, we came to the conclusion that most likely nobody answered on the remote server, they wrote in support to figure it out. - walik
  • You definitely need a service name, maybe sid? I just can't remember if service access was implemented in the php driver - Giga Kokaia

0