Click here to Skip to main content

PHP with Oracle 11g on Windows 7 64-bit


Now a day, many PHP applications have been developed keeping Oracle as database instead of MySQL and it’s a very common problem for those, using Oracle 11g in Windows 7 (64-bit) with PHP applications that the connection of Oracle database has been refused to connect. Here I have used Instant Client to connect Oracle database with my PHP application.

Instead of using separate installation of PHP and Apache, I have used here WAMP server. Just follow the step-by-step to connect Oracle database with PHP applications on the platform of Windows 7 (64-bit).


STEP 1. Install WAMP server and Oracle 11g at first.

STEP 2. For Windows 7 (64-bit), extract, downloaded from to C:\Windows\SysWOW64\instantclient_11_2 and set it on PATH variable for Environment variable.

STEP 3. Reboot the system now.

STEP 4. Allow PHP extension from php.ini as

extension=php_oci8_11g.dll (just remove the ";" from the start of the line)

STEP 5. Restart WAMP server.

STEP 6. Open the file to see the database name as D:\app\Farhan\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora

  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

      (SID = CLRExtProc)

    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (SERVICE_NAME = orcl.168.1.2)

Here, the service name is found as "orcl.168.1.2" .

STEP 7. Make the connection in PHP script as oci_connect(your_username, your_password, "localhost/orcl.168.1.2");


Now try it on your environment, wish you will be succeeded easily to connect with Oracle database from PHP applications on the platform of Windows 7 (64-bit).
Web04 | 2.8.160207.1 | Advertise | Privacy
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service