Click here to Skip to main content
Click here to Skip to main content

PHP with Oracle 11g on Windows 7 64-bit

, 8 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
It’s a very common problem for those, using Oracle 11g in Windows 7 (64-bit) with PHP applications.


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).


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Zamshed Farhan
Software Developer
Bangladesh Bangladesh
I have received B.Sc. degree in Computer Science and Engineering from Khulna University of Engineering and Technology, (KUET) Bangladesh in 2003 and Master of Business Administration in Management from University of Dhaka, Bangladesh in 2009. I started my IT career as a Software Engineer at BDCOM Online Limited, then worked for BRAC BDMail Network Limited (bracNet). At present, I am working with Application Development, Integration and Maintenance department of the International Centre for Diarrhoeal Disease Research, Bangladesh (ICDDR,B) - an international health research organization located in Dhaka, Bangladesh, dedicated to saving lives through research and treatment.
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

Questioninstalling xamp,php instant client to connect to remote oracle using sql developer PinmemberMember 1110159821mins ago 
QuestionThank you to save our life PinmemberNhong Pornpot20-Apr-15 4:53 
AnswerRe: Thank you to save our life PinmemberZamshed Farhan20-Apr-15 6:31 
Questionphp with oracle 11g in wamp server PinmemberMember 1141438930-Jan-15 1:33 
QuestionCan you help me to bunch Oracle + PHP + Apache? Need Your help! [modified] PinmemberAndreMareg20-Dec-14 1:37 
Questionthanks PinmemberMember 963455215-Jan-13 2:51 
AnswerRe: thanks PinmemberS.M. Zamshed Farhan15-Jan-13 3:55 
Questioncore java PinmemberMember 963455213-Jan-13 0:40 
AnswerRe: core java PinmemberS.M. Zamshed Farhan15-Jan-13 0:39 
Questionre patient form PinmemberMember 963455211-Jan-13 5:33 
AnswerRe: re patient form PinmemberS.M. Zamshed Farhan11-Jan-13 5:40 
Questionpatient form PinmemberMember 963455210-Jan-13 20:36 
AnswerRe: patient form PinmemberS.M. Zamshed Farhan11-Jan-13 4:52 
Yes. I understand. But it's not clear to me that what type of support you need from me?
AnswerRe: patient form PinmemberS.M. Zamshed Farhan11-Jan-13 4:54 
Questionphp PinmemberMember 96345529-Jan-13 21:09 
AnswerRe: php PinmemberS.M. Zamshed Farhan10-Jan-13 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 8 Jan 2013
Article Copyright 2013 by Zamshed Farhan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid