12 Replies Latest reply: Sep 1, 2011 3:02 PM by FlyingGuy RSS

    OCI8 not displaying in phpinfo() [SOLVED]

    884377
      I can't get oci8 to install at all. Here is what I've tried...

      1.) checked for duplicate php.ini files (none found)
      2.) added instant client files to windows\system32 (did not work)
      3.) tried PHP 5.2, 5.3.2 and 5.3.0 (none work)
      4.) checked the extension=php_oci8.dll and all other oci dll's were un-commented in my php.ini (all where un-commented)
      5.) checked that the .dll's where in the "ext" directory (they are all there)
      6.) added to my environment variables ORACLE_HOME with the path to the instantclient directory (did not work)
      7.) checked and rechecked that my path variable is set to the right instant client directoy (it is set to the right place)
      8.) checked to be sure that the folder had permissions to access from IUSR_ account (checked ok, and added everyone just to be sure. still not working)
      9.) un-commented and set "extension_dir" in the php.ini to the directory of my php .dll's (did not work)
      10.) rebooted and re-stared IIS or the server a million times. after each environment var change or php.ini change (did not work)
      11.) tried 64bit instant client and 32bit instant client (neither worked)
      12.) if I try to run sqlplus from the cmd box I get "program is not configured correctly try reinstalling it." Funny thing is that program doesn't even get installed...
      13.) Added to my environment vars TNS_ADMIN and the path to the tnsnames.ora file (did not work)
      14.) tried to putenv("ORACLE_HOME=<path to instant client>"); (did not work but getenv("ORACLE_HOME") return the right path even when I don't putenv();)

      I've never had a problem setting up instant client or oci8 libraries before today...

      The server that is giving my trouble is a VPS hosted 64bit windows 2003 server with IIS6. (this server is evil!!)

      Any help is appreciated. I would love to get some sleep tonight. I have been working on this problem foe three days now.

      Edited by: salt on Aug 31, 2011 3:56 PM

      Edited by: salt on Sep 1, 2011 11:14 AM
        • 1. Re: OCI8 not displaying in phpinfo();
          884377
          One other thing...

          There are no other installations of oracle on this system (i checked the registry to confirm) and the path to my instant client libraries are first in line on the PATH environment var. phpinfo() confirms that path has the right directory in place.
          • 2. Re: OCI8 not displaying in phpinfo();
            cj
            If you have a local database installed, then you don't need Instant Client. This might be causing a clash.

            How were you installing PHP? What version of Oracle DB are you using and where is it located?

            #12 points to an issue with the installation of Oracle. Sort that out first and get SQL*Plus connectivity working. After that, revisit PHP.

            #14 Never do that, since libraries may be initialized before your script runs. You may end up setting a different value causing all chaos. Also ORACLE_HOME is NOT NEEDED at all for Instant Client

            #11 Since PHP is 32 bit, you'll need to use 32 bit Oracle libraries

            #13 tnsnames.ora has a special syntax; you can't set environment variables here.

            It sounds like you've been doing some good Googling. Possibly you came across: http://blogs.oracle.com/opal/entry/how_to_use_iis_php_and_oracle and http://blogs.oracle.com/opal/entry/using_php_oci8_with_32-bit_php
            One other "as a last resort hack" you don't seem to have tried is something like this: OCIEnvNlsCreate() failed. which may or may not apply to IIS.
            • 3. Re: OCI8 not displaying in phpinfo();
              884377
              Hello,

              No there is no other oracle install on this server just the client libraries. Still no luck... Don't know why yet either. I wanted to be sure that I am not doing something wrong so I pulled up another server and installed IIS6, Instant client and PHP and it all went smooth as butter. I am wondering if there is a compatibility problem with windows 2003 enterprise x62 R2 OR if maybe the path variables are not loading correctly because the server is VSP hosted.

              Just don't know yet...
              • 4. Re: OCI8 not displaying in phpinfo();
                FlyingGuy
                Never, EVER trust anything hosted. ESPECIALLY if it is an amazon EC2 instance.

                Unless you just have to do this on windows I really suggest doing this on a linux box. The install is really really simple and it just works.
                • 5. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                  884377
                  Ok, so I've tried installing oci8 on two different windows 2003 enterprise R2 x64 machines and it will not go. My guess is that you can't run oci8 on a 64 bit windows system. I cancelled my hosting and signed up for a dedicated hosting on a windows 2003 standard x86 machine. SAME problem... oci8 will not install. I've been able to install oci8 on two different machines both windows 2003 x86 machines just fine but this new dedicated host will not go. What is the deal? Where am I going wrong. I need to stay with this host because we shelled out a ton of money for it and there is no reason why this new server should fail. I don't see any errors on the install or in the windows event viewer. If I go to a DOS prompt and execute php.exe -m there are no errors and the oci8 library does not load. Where should I look for errors?

                  Please Help!!
                  • 6. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                    FlyingGuy
                    Ok,

                    1st How did you install oci8 ?

                    2nd Does php work in general ie: can you get the phpinfo() ?

                    IF you installed php with pear and pecl you should have installed from the cli as: pecl install oci8

                    Doing it that way will handle all of the 32 / 64 bit issues at least on Linux since it compiles oci8 on web server

                    I have never installed in on Windows, sorry just never have.

                    Read the following thread very carefully:

                    http://blogs.oracle.com/opal/entry/using_php_oci8_with_32-bit_php
                    OCI8 IN WINDOWS SERVER 2008 x64
                    http://www.phpdeveloper.org/tag/oci8

                    That is really the best I can do for you. Sorry I can't be of more help but I just don't do IIS and windows.

                    If I had the time and a lab I might, but doing this on LAMP machine 32 or 64 bit and connecting to any Oracle box or local DB server is a walk in the park.

                    I highly recommend unless it is purely for development purposes never running Oracle on a machine that runs anything else. Oracle is both Memory and CPU hungry and does not like to share, hence its inanely fast performance.
                    • 7. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                      cj
                      Did you ever get sqlplus running - this was #12 on your original list?
                      If this doesn't run, fix this before trying with PHP.
                      • 8. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                        884377
                        I decided to try a different approach. I discovered the problem is not with oci8 but the instant client libraries are the problem. I am unable to run sqlplus or oci because of problems with dynamically linked libraries. I ran sqlplus.exe and oci.dll through dependency walker (great program) and after replacing all the missing .dll files I get this error.

                        Error: The Side-by-Side configuration information for "c:\oracle\instantclient_11_2\OCI.DLL" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
                        Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

                        Error: The Side-by-Side configuration information for "c:\oracle\instantclient_11_2\SQLPLUS.EXE" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
                        Error: The Side-by-Side configuration information for "c:\oracle\instantclient_11_2\OCI.DLL" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
                        Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

                        problem DLL's according to dependency walker:
                        kernel32.dll
                        msvcrt.dll
                        ntdll.dll
                        rpcrt4.dll
                        duser.dll
                        shell32.dll
                        uxtheme.dll

                        There seems to be problems with the way instanctclient is compiled with regards to the linker or statically loaded libraries vs. dynamically loaded libraries. Just a guess... but strange that oracle would release software that does not work on 1/2 of all windows servers.
                        • 9. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                          cj
                          What exactly did "replacing all the missing .dll files" entail?

                          The name msvcrt.dll rings a bell though I thought this was a long gone issue. An older support note 338900.1 mentions installing .NET. Check the web for other potential solutions. I don't know how your hoster has configured the machine. It sounds like they don't have some Windows libraries installed.

                          Don't forget you need the 32bit Instant Client to be able run PHP. See http://blogs.oracle.com/opal/entry/using_php_oci8_with_32-bit_php

                          You might want to post followup questions to the Instant Client forum: Instant Client
                          • 10. Re: OCI8 not displaying in phpinfo() [Still Not Resolved];
                            FlyingGuy
                            @CJ - msvcrt.dll is the Microsoft Visual C Run Time Library.

                            Try ripping everything out and installing the standard client with the "Administration" option checked.

                            This will ensure it is using tnsnames for the host resolution, when all else fails, this usually works and ti will test you connectivity as well.

                            Did you ever tell us if you are trying to run EVERYTHING on the same box or do you have your Oracle server on a separate machine?
                            • 11. Re: OCI8 not displaying in phpinfo() [SOLVED]:
                              884377
                              I finally have it working!!! Here is the solution for anyone else having this awful problem. I'm sure that reading on the net you will find a lot of posts were people installed different Microsoft C++ Redistributables. I tried Microsoft C++ 2005 redistributable, that didn't work. I tried Microsoft C++ 2008 redistributable, that didn't work. I even tried 2008 SP1 and 2010. Neither of them worked. Finally I got the bright idea to install Microsoft Visual Studio C++ 2008 express with the option to install MSSQL express. There must have been more unregistered libraries that visual studio install had than there were in the C++ redistributable installs. So now the instant client and sql plus libraries are working and OCI8 now shows up in the phpinfo();
                              • 12. Re: OCI8 not displaying in phpinfo() [SOLVED]:
                                FlyingGuy
                                Brilliant!!!!!

                                Would you mind terribly writing this up in an outline our stel by step fasion and sending it along to CJ.

                                Some detective work might have to be done to figure out exactly what DLL's / Registry entries would have to be modified / added, but we would be darned obliged if you could take a crack at it. Thanks HUGELY in advance.