I am not able to connect to Remote Oracle database using below code.
Code: Select all
<span> Display something - Top </span>
<?php
if ($c = oci_connect("puru", "purusoth123", "//mysystem.network1.xyz.com:1522/db1")) {
echo "Successfully connected to Oracle.";
oci_close($c);
}
else {
$err = oci_error();
echo "Oracle Connect Error " . $err['text'];
}
?>
<span> Display something - Bottom </span>
PS :
===
1. mysystem.network1.xyz.com is host name of a system in our LAN. I am able to ping the system by this host name.
2. db1 is my database name in oracle.
3. I am able to connect and query this database through Oracle SQL Developer application.
Steps I following to enable oracle access:
===============================
1. Copied php_oci8.dll and/or php_oci8_11g.dll to "D:\Program Files\PHP\ext" (those files I got from http://downloads.php.net/pierre/).
2. Downloaded Oracle Instant Basic client and unzipped to directory "D:\Program Files\Oracle - instantclient-basic-win32-11.1.0.7.0\instantclient_11_1".
3. added "D:\Program Files\Oracle - instantclient-basic-win32-11.1.0.7.0\instantclient_11_1" to environment variable PATH.
4. In php.ini file, added extension=php_oci8.dll under
Code: Select all
section
5. And already extension_dir="D:\Program Files\PHP\ext" is available(ie, already not commented).
6. Then I restarted Apache and tried above php code.
Its not working.
Please let me know where I am doing mistake.
Note : I already tried with odbc_ api calls but failed.
Regards,
Purusothaman A