Configuring XAMPP PHP with OCI8 on Windows 7 64bit

This article shows you how to configure your XAMPP with Oracle extension on Windows.

Not like Linux or Mac OS, To connect Oracle database in Windows system, you need Oracle client DLL for Windows to connect Oracle database. XAMPP did come with Oracle client libraries, so you have to instal it manually.

phpOci8

  • Enable Oci dll in php.ini

uncomment the php.ini line

extension=php_oci8_12c.dll,

there may have more than one “php_oci” like extension, but ONLY ONE of these DLLs may be enabled at a time.

ociPhpini

But if you restart Apache now, then you will got errors like “oci.dll is missing”, so our work is not done yet.

  • Install Oracle Instant Client

Oracle Instant Client is free, light-weight Oracle Database libraries and SDKs.

Oci

Click proper download link for your OS, please note, since your xampp installed 32bit php, so you have download 32bit release, otherwise, the oci8.dll will not working properly.. You will download a zip file, which need to unzip to a certain directory, which indicated by XAMPP phpinfo. Like below, you need unzip the instant client into path=c:\php-sdk\oracle\x86\instantclient_12_1

  • Set Windows system PATH

The last step, you have to set path c:\php-sdk\oracle\x86\instantclient_12_1 into Windows system PATH environment variable, so PHP can access all these .dll files.

ociphpInfo

You can use command line to do this. But it may distroy other settings. So here is a safeway to do that (Window 7):

  1. click the Start button, right-click the Computer option in the Start menu, and select Properties.
  2. Click the Advanced System Settings link in the left column.
  3. In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom of that tab.
  4. In the Environment Variables window (pictured below), highlight the Path variable in the “System variables” section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon.

Note: you need admin permission to do PATH change.

Now, you have complete the Oracle extension installed on your computer, you can now restart XAMPP to make it applied.

phpOci8Installed

 

Related urls http://php.net/manual/en/oci8.installation.php http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

Advertisements

About qianggan

Sr. Software Engineer
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s