OCI8 php extension installation on windows server

Yoshi picture Yoshi · May 30, 2014 · Viewed 11.4k times · Source

I have specific problem with making OCI8 work on my server installation.

First setup:

  • Win 2008 Server 32bit
  • ZendServer for PHP with Apache2.2
  • PHP version 5.3.14 which was without php_oci8 files
  • No oracle things installed

I need to be able to connect to remote oracle database, so I find out, that OCI8 extension should be used. To make OCI8 work, I also should need at least Oracle Instant Client on server, because of certain DLL OCI8 need.

What I did?

  • downloaded Oracle Instant Client from their sites ( oracle download site ), version 11.2.0.4.0
  • unpacked into folder, I choosed Program Files/oci_11_2
  • added to windows variable path the address
  • restarted Win
  • downloaded php_oci8 libraries from PECL ( PECL oci8 dl site )
  • put them into the ext directory set in php.ini
  • added extension=php_oci8.dll into php.ini
  • restarted apache

After all this I checked php_info to see, if everything is ok, however no signs of oci8.

I tried older Oracle instant client, swtiching between php_oci8.dll, php_oci8_11g.dll or php_oci8_12c.dll, yet nothing helped.

I found, that due to php_info in environment section doesn't show the same values, as one that are set in windows. From php error log I also got following:

[30-May-2014 08:02:16 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\Zend\ZendServer\lib\phpext\php_oci8_11g.dll' - The specified module could not be found. in Unknown on line 0

Currently, I have no idea what to do, unless trying reinstalling php(which I don't want to because of many problematics connected with that), different Oracle instant clients or differenct php_oci8 libraries. I google for some hours, tried looking on Stack, but no solution, just some tips, that didn't help. Have someone encountered and solved something similar?

Answer

Anmol Mourya picture Anmol Mourya · Jul 21, 2017

I have Same Issue, Following steps helped me out.

  1. Download instantclient and place "C:\instantclient_11_2"

  2. Set environment variable for C:\instantclient_11_2

  3. Check your php version i.e. PHP Version 5.6.15

  4. Form http://pecl.php.net/package/oci8 download exact version, for me its php_oci8-2.0.8-5.6-nts-vc11-x86.zip, unzip it and copy php_oci8_11g.dll to php ext folder, for me its "C:\xampp\php\ext"

  5. Un-Comment "extension=php_oci8_11g.dll" in php.ini and restart apache

  6. check php_info(), oci8 should be enabled.

    Thats all.