Call to undefined function oci_connect() Call to undefined function oci_connect() oracle oracle

Call to undefined function oci_connect()


I just spend THREE WHOLE DAYS fighting against this issue.

I was using my ORACLE connection in Windows 7, and no problem. Last week I Just get a new computer with Windows 8. Install XAMPP 1.8.2. Every app PHP/MySQL on this server works fine. The problem came when I try to connect my php apps to Oracle DB.

Call to undefined function oci_pconnect()

And when I start/stop Apache with changes, a strange "Warning" on "PHP Startup" that goes to LOG with "PHP Warning: PHP Startup: in Unknown on line 0"

I did everything (uncommented php_oci8.dll and php_oci8_11g.dll, copy oci.dll to /ext directory, near /Apache and NOTHING it works. Download every version of Instant Client and NOTHING.

God came into my help. When I download ORACLE Instant Client 32 bits, everything works fine. phpinfo() displays oci8 info, and my app works fine.

So, NEVER MIND THAT YOUR WINDOWS VERSION BE x64. The link are between XAMPP and ORACLE Instant Client.


Simple steps

You need to enable the below extension in your php.ini

;extension=php_oci8.dll;extension=php_oci8_11.g.dll

by removing the ";" so that the results will below:

extension=php_oci8.dllextension=php_oci8_11.g.dll

Download Oracle Instant Client:- Preferably 32 bit. 32 bit will also work on 64 bit. You can just google: download oracle instant client windows 32 bit. Use version 11 of the client because extension=php_oci8_11.g.dll won't work with 12. Unzip the package into a location such as C:\Oracle\instantclient_11_2.

Finally modify the System's PATH Environment Variable with end location, under system variables not user variables

Then you need to restart the System for PATH changes to fully propagate.

If you just restart XAMPP/WAMP without restarting the machine the Client's DLL files (i.e. OCL.dll) will not be loaded (nor found)by PHP's php_oci8_11g.dll extension.


Things to Make sure

  1. Whenever you connecting Oracle Database , try to use 32 Bit oracle client libraries, Since XAMP PHP is compiled with 32 Bit(Though you have 64 Bit windows Machine)
  2. Download Oracle Client from Download From here

  3. Paste it in C:\instantclient_12_1

  4. Then Set the path to above in System Environment Variable
  5. Then Go to C:\xampp\php\php.ini and uncomment extension=php_oci8_12c.dll
  6. Then Restart the XAMP and it should work without any Issue.