Web Analytics

Running PHP 5.3.6 with Oracle support on Windows Server 2008 (64bit)

I was involved in a project for running a media portal with Apache/PHP and Oracle database and was asked to build the environment. As the title says it's a Windows Server 2008 Standard edition (no enterprise, no failsafe) what's more the licenses for Oracle Database were for Standard Editon for one server. I managed to create a HA environment for both Apache and Oracle Database, but this is another topic which I hope to describe later.

The problems which took me most time and efforts were user equivalence during Grid Infrastructure installation and running Apache/PHP with Oracle support.

In case you have installed PHP with Oracle support (enabled extension=php_oci8_11g.dll at php.ini) and does not see any OCI8 support in phpinfo(); or run in following errors during Apache startup:

The requested operation has failed!

OR

httpd.exe:
The application has failed to start because OCI.dll was not found.
Re-installing the application may fix the problem.

Then most probably you're trying to run PHP (which is 32bit) with Oracle OCI library (which is 64bit). I had installed database binaries already on both machines and that's why I had oci.dll in the PATH variable. Now PHP is trying to load my 64bit oci.dll library and fails, this could easily be determined with file command:

sve@angmar:/tmp$ file oci.dll
oci.dll: PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly
sve@angmar:/tmp$ file php.exe
php.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit

The solution was to download Oracle instant client 11.2 (32bit!) and put it for example in PHP home directory. Then the path has to be added to the environment variable PATH at first place. Now OCI8 support is enabled and Apache server is starting normally, also running file against new oci.dll shows following:

sve@angmar:/tmp$ file oci.dll
oci.dll: PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit

Regards,
Sve