7 Replies Latest reply: Aug 7, 2012 1:23 PM by 643471 RSS

    php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()

    762937
      Hi,
      i am currently dealing with a weird issue,

      I am trying to connect to an Oracle database using the "instantclient_11_1" with windows/PHP Version 5.2.3 (under apache)

      I have uncommented the extension=php_oci8_11g.dll in the php.ini

      I have set the windows path

      PATH ---> C:\instantclient_11_1

      PHPRC ---> C:\PHP

      TNS_ADMIN -----> C:\instantclient_11_1

      The server have been restarted also

      The php_oci8_11g.dll will also not load into the phpinfo();

      Any idea what could cause the problem??

      I have been looking on this for 2 days... i am quite anxious to find a solution, its a show stopper for my project.

      Help would be greatly appreciated.

      Thanks,

      M

      Edited by: user9344961 on Mar 26, 2010 11:35 AM
        • 1. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
          cj
          Does phpinfo() show the correct php.ini being loaded?

          What is in the Apache error log?

          Do you have any other Oracle libraries on the machine that are causing a clash?

          Where are you setting the variables?

          Have you used a tool like Dependency Walker to check the php_oci8_11g.dll can
          find the libraries it requires?
          • 2. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
            762937
            Hi cJ2,
            thanks for the reply.

            the correct php.ini being loaded, when i uncomment ;extension=php_oci8.dll , it shows in phpinfo()

            Regarding the Apache error log, it was a good call, I noticed the error below in the log.

            Error:
            PHP Warning: PHP Startup: Unable to load dynamic library './ext/php_oci8_11g.dll' - The specified procedure could not be found.\r\n in Unknown on line 0

            There was an older Oracle instant client(Oracleinstantclient), but i renamed the folder.
            And i made sure to comment extension=php_oci8.dll when using php_oci8_11g.dll

            As for the variables, do you mean the windows variables? if so, they were set in the system variables.

            I used Dependency Walker to check the php_oci8_11g.dll, i have an error on a DWMAPI.dll , is that file actually required??

            Thanks for your help, its greatly appreciated!!!

            M

            Edited by: Elquesto on Mar 29, 2010 4:34 AM

            Edited by: Elquesto on Mar 29, 2010 4:34 AM
            • 3. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
              cj
              If php_oci8.dl works but php_oci8_11g.dll doesn't then I expect Windows is
              loading Oracle 10g libraries which don't have all the symbols needed by the
              11g compatible php_oci8_11g.dll library.

              I vaguely recall something quirky with Windows/Apache with renaming folders containing
              libraries. Did you triple check your path? Did you reboot?
              • 4. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
                762937
                Thanks for your help cj2, i finally went back to the php_oci8.dl. The organization will go from scratch on a new server and upgrade the technologies at the same time instead of trying to integrate it to an existing server.

                The dev server had php_oci8_11g.dll and the production had php_oci8.dl.

                I had triple checked the path and rebooted. i should of deleted the old libraries, its pretty much the only thing i did not do.

                Thanks again for your help,

                Its appreciated :)

                PS: I might reappear in a few weeks

                M
                • 5. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
                  834173
                  I was struggling to get the oci extensions running in PHP on IIS 7.5 on Windows 2008 R2. After about 10 hours, here was my solution:

                  Download the 32-bit Oracle Instant Client and put it somewhere useful (I put it under my php directory). Add it to your system's PATH.
                  http://www.oracle.com/technetwork/database/features/instant-client/index-100365.html

                  Edit your php.ini and uncomment extension=php_oci8_11g.dll

                  After this, it was running fine under the CLI. With the command php -m, I would see the oci8 module listed. IIS, however, still did not show OCI8 under phpinfo and would throw the undefined function error. So I added the instant client folder to my php path under IIS and OCI8 showed up under phpinfo and IIS was able to run the Oracle commands under PHP:

                  1) In IIS Manager, go to your web server home and choose FastCGI Settings. Highlight the php-cgi.exe entry and choose Edit...

                  2) Under Environment Variables, click the box with ... to add another variable.

                  3) Add PATH with the Value: %PATH%;C:\php\instantclient_11_2 (where the instantclient_11_2 path is its location on your server)

                  4) Restart the IIS server.
                  • 6. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
                    cj
                    Thanks for the info - I'm sure someone will find it useful.
                    • 7. Re: php_oci8_11g.dll  -- Fatal error: Call to undefined function oci_connect()
                      643471
                      Apologies for posting to an old thread, but it was the first to come up when I googled the problem before I remembered how I've solved it before.

                      A quick & dirty fix on Windows is to copy all of the *.dll files from the 11g InstantClient package* into the same directory as your webserver's executable (e.g. httpd.exe). This is the first place the server looks for any dll dependencies. (*Make sure you get the correct architecture for InstantClient (32/64 bit)).

                      I can confirm this works with Apache httpd on Windows (haven't tested IIS). In my experience, it also works in general for any application that can't find the correct external dlls, e.g. if you have multiple versions/architectures of a library on your machine, or if you don't want to add them to PATH.

                      In my case (32-bit httpd), I copied:
                      oci.dll
                      ocijdbc11.dll
                      ociw32.dll
                      orannzsbb11.dll
                      oraocci11.dll
                      oraociius11.dll

                      to [httpd root]/bin

                      I'm sure you don't need all of the dlls, but it's easier to just grab them all.

                      HTH someone,

                      - Anthony