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
$db = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" . $ORACLE_HOST . ")(PORT=" . $ORACLE_PORT . ")))(CONNECT_DATA=(SID=" . $ORACLE_DB . ")))";
$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 10.10.40.21:1521.
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?
It seems even though
phpinfo
can detect oracle client version 18.5 but it fails to getORACLE_HOME
directoryIf you only set
in client's virtual host config file
This adds
ORACLE_HOME
toPHP Variables
only which has NO EFFECT fixing the problemInstead
You need to add
in client's
php-fpm
config fileThis adds
ORACLE_HOME
under bothPHP Variables
andEnvironment
which fixes the problem.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:Also see this troubleshooting guide.
You've got two problems:
echo $ORACLE_HOME
set?