Wednesday 27 January 2016

Connect to PHP with Oracle database via configuring Oracle Instant Client for Linux and Windows

PS: Create the Databases on Oracle after installing the Oracle Express Database XE 11.2, then follow the below step to enable OCI to connect to PHP.

1. Open the php.ini and uncomment the below line.
extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client

2. Download the php_oci8_11g.dll files from the link below based on your version, find the "Thread Safe (TS) x86" version.

https://pecl.php.net/package/oci8/2.0.8/windows

Then, unzip the files and copy to the php/ext/ folder.

3. Next, download the "Instant Client Package - Basic" for Windows from the Oracle Instant Client page.
Because PHP is 32 bit, download the 32 bit version of Instant Client from here.

Package Name
Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications 
Download instantclient-basic-nt-11.2.0.4.0.zip (51,477,933 bytes)

Once downloaded, unzip the Instant Client files to C:\instantclient_11_2

4. Then, edit the Windows PATH environment setting and add C:\instantclient_11_2.
For example, on Windows XP, follow Start -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System Variables list.

Normally, you need to reboot Windows so the new environment is correctly set.

5. If does not work for some reason, please check the files path and location once again.

6. Also, if still does not work, you may try download this package "Microsoft Visual C++ 2012 SP1 Redistributable Package (x64)" and install it.
 (I am not sure when we would require to install it, try without it first as it may not require on your case).

Find more information for Linux and other stuff here...

No comments:

Post a Comment

Please post any queries and comments here.