Connecting PHP to Oracle Database 10g

PHP is very well compatible with MySQL. But I found connecting PHP to Oracle is a pain. In my current job, my employer uses Oracle Version 10g. It uses an oracle server and an oracle client 10g software to connect to the server. I tried several ways to connect to the oracle database server using PHP.



Each time WAMP generated the following error

[code]PHP Startup: Unable to load dynamic library ‘e:/wamp/bin/php/php5.4.3/ext/php_pdo_oci.dll’ – The specified procedure could not be found.[/code]

Its because we need to find a compatible version of OCI8.dll supplied by oracle to connect to oracle server. The following configurations are compatible and worked for me well.
Finally I was successful. The simplest way to connect to the Oracle database using PHP and extracting data from database is as follows

Assuming you are using a Windows Operating System

1. Install latest WAMP Server2 for windows

2. Download and install separate PHP5.2.6 from WAMP website

3. Download and install APACHE Version 2.2.2 from WAMP website

4. Now left click on the WAMP Server icon running in your taskbar.

5. Go to Apache->Version->2.2.2


6. Go to PHP->Version->5.2.6


7. Activate both PHP_PDO and PHP_PDO_OCI extensions of PHP from WAMP server control panel as shown bellow.php-oracle-activate-oracle-pdo-extension

8. Restart all services of WAMP

Now WAMP should not generate any error and the following code should execute

Print Friendly

Related Posts

Written By:
  • itswadesh

    new comment

  • Mirchu

    nice tutorial 🙂

  • channu yatnur

    not working i did all settings….