I need to connect oracle 11g database with my xampp server and I need both local and remote connection. For that what I did is first I installed the oracle 11g express edition and the downloaded the instantclient-basic-nt-11.2.0.4.0
and placed the extracted folder instantclient_11_2
in C:\
then I set the environment variable (system variables) and my path value looks like this path=C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\instantclient_11_2
.
Then I removed the ;
before extension=php_oci8.dll
and extension=php_oci8_11g.dll
from the php.ini
file. Then first I tried to connect with my local database:
$tns_turjo = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.13)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))'; // tns of another pc
$tns_ishrak = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.18)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))'; // tns of my pc
$conn = oci_connect('system', 'cibl123*#', $tns_turjo);
if($conn) {
echo "connected";
}
else {
echo "not";
}
When I pass $tns_ishrak
it echoes connected
but when I try to access the oracle database of another pc i.e. use the $tns_turjo
then it echoes not
and the error is
Message: oci_connect(): ORA-12170: TNS:Connect timeout occurred
I have also changed the username and password while connecting to another pc.
N.B. After enabling the .dll extensions from the php.ini file whenever I start the Apache I get a pop up warning in xampp which is Module 'oci8' is already loaded
How can I solve the remote connection issue?