Connecting WAMP Server to Oracle With PHP’s php_oci8_11g.dll

Download the proper Oracle Instant Client

If using 32 bit PHP, you’ll need use the 32 bit Windows Oracle Instant Client:
Instant Client Downloads for Microsoft Windows (32-bit)

Download package:
"Instant Client Package - Basic Lite"

Use version 11 of the client, not 12, with PHP’s php_oci8_11g.dll.

Unzip the package into a location such as:
C:\WampDeveloper\Tools\Oracle\

Then modify the System’s PATH Environmental Variable with the end location. As otherwise the Client’s DLL files (i.e., OCI.dll) will not be found (nor loaded) by PHP’s php_oci8_11g.dll extension…
C:\WampDeveloper\Tools\Oracle\instantclient[version]

Restart the system for PATH changes to fully propagate.

Install the VC++ 2012 Runtime

Under PHP 5.5, which is a VC11 (VS.NET 2012) build, some of the extensions depend on the full set of Microsoft VC++ 2012 Runtime DLLs.

Download and install the 32 bit VC++ 2012 Runtime Redistributable (vcredist_x86.exe):
Visual C++ Redistributable for Visual Studio 2012 Update 4

PHP 5.5 extension php_oci8_11g.dll, and other extensions such as php_intl.dll, depend on files: msvcr110.dll and msvcp110.dll, which this will place into your C:\Windows\System32 folder.

Check Dependencies of php_oci8_11g.dll

Open the command line, change to the PHP’s directory, and check to see if all php_oci8_11g.dll dependencies (DLL files) are being found.

C:
cd \WampDeveloper\Components\Php
deplister ext\php_oci8.dll
deplister ext\php_oci8_11g.dll

Everything should be listed as found, and you should not see this: OCI.dll,NOTFOUND… Which indicates that the Oracle Client DLL is not being found.

Load php_oci8_11g.dll

Edit php.ini and un-comment:

extension=php_oci8.dll
extension=php_oci8_11g.dll

Save file. Restart Apache.

Then check to make sure this module has been loaded:
http://serverhost/phpinfo.php

* phpinfo.php contains this code: <?php echo phpinfo(); ?>, and will show you all the loaded PHP extensions and their settings.

Issues

PHP Startup: Unable to load dynamic library ‘C:/WampDeveloper/Components/Php/ext\php_oci8_11g.dll’ – %1 is not a valid Win32 application.

This indicates a build-type mismatch.

The used PHP extension (php_oci8_11g.dll) is not matching the PHP build type: 32bits (x86), VC11 (VS.NET 2012), TS (Thread Safe). * TS (Thread Safe) is for Regular PHP; NTS (Not Thread Safe) is for PHP-FCGI.

Chances are you are using the 64-bit build of php_oci8_11g.dll, or a VC9 build, or a NTS build – that replaced the default ext\php_oci8_11g.dll file that PHP came with.

Unable to load dynamic library ‘C:/WampDeveloper/Components/Php/ext\php_oci8_11g.dll’ – The specified module could not be found.

The module is being found (and you can verify that it’s present), but the real problem is that it has dependencies on other DLLs which are not being found.

Update the System’s PATH Environmental Variable with the Oracle Instant Client’s OCI.dll file location.

Also make sure PHP’s root folder is in the PATH. * It and PHP’s “\ext” path should already be listed in WampDeveloper’s %wampdev% environmental variable (which itself is expanded in %path%).

* In the error message, the backslash (“\”) being used instead of the “/”, is never the problem.

Oracle Instant Client Version 11 vs. 12

You should use the Oracle Instant Client version that matches the php_oci8 extension version:

Use client version 11 for extension php_oci8_11g.dll

Use client version 12 for extension php_oci8_12c.dll

You can download the oci8 extension for client version 12 from:
http://windows.php.net/downloads/pecl/releases/oci8/

The nomenclature of the extension’s file name to built-type is:

  • PHP 5.5 32bit: TS, VC11, x86
  • PHP-FCGI 5.5 32bit: NTS, VC11, x86

For WampDeveloper’s PHP 5.5 (regular, not FCGI) 32bit channel, you would get this file:
php_oci8-2.0.8-5.5-ts-vc11-x86.zip

Unzip the contents into PHP “\ext” folder (make sure to overwrite all files), and load it via php.ini:

extension=php_oci8.dll
extension=php_oci8_12c.dll

PDO

If your code uses PDO methods to connect to databases, you’ll also need to load this extension:

extension=php_pdo_oci.dll

Notes

OCI8 Requirements (php.net)

Using PHP OCI8 with 32-bit PHP on Windows 64-bit

Installing PHP and the Oracle Instant Client for Linux and Windows, For PHP 5.4 and Oracle Database 11g Release 2

Installing PHP and the Oracle Instant Client for Linux and Windows, For PHP 5.5, OCI8 2.0 and Oracle Database 12c Release 1

9 thoughts on “Connecting WAMP Server to Oracle With PHP’s php_oci8_11g.dll”

  1. Is this correct for php7 beta3 ? :
    Seems php7ts.dll is not used by php_oci8_11g.dll (httpd.exe system error php5ts.dll is missing).
    Seems php_oci8_11g.dll tries to work with php5ts.dll instead with php7ts.dll, but can not because of:
    php5ts.dll – Module compiled with module API=20121212
    PHP compiled with module API =20141001 These options need to match.
    So php_oci8_11g.dll is not loaded and we can not connect to 11g until somebody makes php_oci8_11g.dll build with VC2014.

    1. PHP7 releases switched from VC11 builds to VC14 builds when it went from alpha to beta.

      The issue is that you need to use Apache 2.4 VC14 and not Apache 2.4 VC11, to be able to load PHP7 VC14…

      You can download from http://www.apachelounge.com/download/

      VC14 builds of Apache and PHP will be able to load a VC11 build of php_oci8_11g.dll.

      WampDeveloepr v5.4 has all this working… Will be released soon.

  2. I am facing this error
    when i start Apache service from the Xammp Control Panel.I got this error message.

    httpd.exe – Entry Point Not Found

    the procedure entry point OCIStmlRelease could not be located in the dynamic link library E:\xammp\php\ext\php_oci8.dll

Leave a Reply to cciko22 Cancel reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>