长治网站建设
win7 64位系统下安装php + Oracle 11g

Introduction

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-by-Step

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

STEP 2. For Windows 7 (64-bit), extract instantclient-basic-windows.x64-11.2.0.3.0.zip, downloaded fromhttp://www.oracle.com/technetwork/topics/winx64soft-089540.html toC:WindowsSysWOW64instantclient_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 asD:appFarhanproduct11.2.0dbhome_1NETWORKADMINtnsnames.ora

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


ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (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");

2006-2014 IT0355.com 山西中联科创科技有限公司. All Rights Reserved.
电话:0355-3728808 传真:0355-3728808
ICP备案号:晋ICP备06003721号本站已通过国际W3C认证
关键字:中联科创,长治网站建设,长治网站推广,长治网络工程,长治软件开发,山西网站建设,山西软件开发 长治五金网