Connecting to Oracle database using Xampp PHP on 32 bit windows7
Created by Tech Team on Sat, 2014-03-29 01:17
We happen to spend a full day while trying to figure out the Oracle 11g database connection using Xampp PHP OCI8 on 32 bit windows7 platform. After doing number of configuration like this on other platforms it was really frustrating.
Following are steps need to follow.
Download Oracle instantClient. from http://www.oracle.com/ for windows 32 platform.
Extract the file into a folder may call OrainstaClient
Copy OCI.DLL, orannzsbb11.dll, oraocci11.dll, oraociei11.dll into windows system32 folder
Edit php.ini. Uncomment extension=php_oci8_11g.dll and set extension_dir=C:\xampp\php\ext
Restart Apache from Xampp Control panel.
Use following code the test connection. Create a php file. Copy & past the code and run the browser.
$conn = oci_connect('USERNAME', 'PASSWORD', 'HOST_IP:PORT/SERVICE_NAME');
$query = 'select table_name from user_tables';
$stid = oci_parse($conn, $query);
oci_execute($stid, OCI_DEFAULT);
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
foreach ($row as $item) {
echo $item." <br />";
}
echo "\n";
}
oci_free_statement($stid);
oci_close($conn);
Need Help? Email: blogs@adaptiveit.net