I have this connection string on an older server which works fine and connects to a remote oracle server.

On this new server I installed oracle instant client simple and devel and php pecl oci8. Below is the screenshot of the oci8.

Here is the code I use to connect

$this->dbh = oci_connect($ORACLE_USER, $ORACLE_PASS, $db);

But when I try to connect to oracle I get this error

oci_connect(): Error while trying to retrieve text for error ORA-28547

If I type a random hostname I get ORA-12154 error which makes sense If I type a random SID I get ORA-12514 error which makes sense If I type a random port I get ORA-12545 error which makes sense If I nc the server and port I get this result

Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to
Ncat: 0 bytes sent, 0 bytes received in 0.02 seconds.

System I use is Centos 7 64bit, php 5.6

Anyone has any idea why this might happen?

enter image description here

  • What version of Oracle? Have you tried TNSPING yet? – Mark Stewart Mar 22 at 14:16

It seems even though phpinfo can detect oracle client version 18.5 but it fails to get ORACLE_HOME directory

If you only set

SetEnv ORACLE_HOME "/usr/lib/oracle/18.5/client64/lib"

in client's virtual host config file


This adds ORACLE_HOME to PHP Variables only which has NO EFFECT fixing the problem


You need to add

env[ORACLE_HOME] = /usr/lib/oracle/18.5/client64/lib

in client's php-fpm config file


This adds ORACLE_HOME under both PHP Variables and Environment which fixes the problem.

enter image description here


Is your sqlnet.ora set up for easy connect? (Located in $ORACLE_HOME//network/admin) Check out Oracle Net Services documentation on setting it up; you should have a line there similar to:

NAMES.DIRECTORY_PATH=(ezconnect, tnsnames)

Also see this troubleshooting guide.


You've got two problems:

  • Oracle can't get the correct translation for error ORA-28547. This is probably because of a incorrect installation/configuration. Is your echo $ORACLE_HOME set?
  • But the real problem is the error ORA-28547 which is "connection to server failed", probably Oracle Net admin error".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.