1 2 Previous Next 15 Replies Latest reply on Oct 4, 2010 3:01 PM by cj


      Good morning,

      I'm trying to configure Oracle with php in Windows server 2008, but when I try to enable Oci8, the php log shows this error:

      "Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8.dll' - %1 is not a valid Win32 application. in Unknown on line 0"

      So that, the phpinfo doesn't show the enabled module. Doesn't Oci8 work with 64 bytes systems?

      I'll appreciate your help.

      Thank you,
        • 1. Re: OCI8 IN WINDOWS SERVER 2008 x64
          Please refer
          • 2. Re: OCI8 IN WINDOWS SERVER 2008 x64
            That Linux bug with building PHP is likely to have nothing to do with a Windows runtime bug.

            Do you have Oracle Instant Client libraries installed or an Oracle DB installed?
            See http://www.oracle.com/technology/pub/notes/technote_php_instant.html
            • 3. Re: OCI8 IN WINDOWS SERVER 2008 x64
              Oh, and that bug was fixed two years ago too.
              • 4. Re: OCI8 IN WINDOWS SERVER 2008 x64
                I have installed oracle 10g 64bits
                • 5. Re: OCI8 IN WINDOWS SERVER 2008 x64
                  Hi there, did you ever get oci8 connected via php on your windows server 2008 x64 bit? I have the same setup and I'm having problems. The oci8 is not loading. It does not appear in the phpinfo output. Thanks Dan
                  • 6. Re: OCI8 IN WINDOWS SERVER 2008 x64
                    What did you install and how did you install it?
                    • 7. Re: OCI8 IN WINDOWS SERVER 2008 x64
                      Oracle 11g R2 64 bit Server. On same machine I have IIS 7.5, Php 5.3.2 x86 VC9 CGI/FastCGI using the ms installer. phpinfo returns all information without a problem in a browser, however if I uncomment the php_oci8.dll or php_oci8_11g.dll extension in the php.ini it throws a 500 http error. Is it because the oracle libraries are 64 bit and oci8 is 32 bit? Would a potential solution be to add 32 bit instant client on the server itself, and is that even possible? thanks Dan

                      Edited by: user1503123 on May 21, 2010 4:11 PM
                      • 8. Re: OCI8 IN WINDOWS SERVER 2008 x64
                        What little I know about IIS is at http://blogs.oracle.com/opal/2006/05/how_to_use_iis_php_and_oracle.html
                        Any corrections and updates from Windows users are welcome.

                        PS If you're going to deploy your application on Linux servers I would
                        recommend also developing on Linux. There are lots of little
                        differences in PHP's file handling etc between the two platforms. It
                        is better to know these early in the development cycle.
                        • 9. Re: OCI8 IN WINDOWS SERVER 2008 x64
                          Regarding 64 & 32 bit compatibility, from experience on other platform I can imagine it might be a problem on Windows.
                          I just checked with the PHP Windows maintainer and it seems 64 bit PHP binaries are some way off.

                          You could use 32 bit Instant Client. Setting up the environment would need to be done carefully to avoid library clashes with PATH.
                          • 10. Re: OCI8 IN WINDOWS SERVER 2008 x64
                            thanks for the suggestions, it's going to be difficult. I've noticed php does load the oci8 extension, only if you enable it in the ms installer at install time. My attempts to enable it in the php.ini after the fact simply were not working. Thus I now have output from the phpinfo() telling me it's loaded oci8. Ofcourse it doesn't actually work when you try to run some code that connects to oracle. The debugger tells me "Warning oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries".

                            The Oracle installer 64 bit refuses to install 32 bit client, so installed it separately, i.e. neither know each other exists. Tried to reset Oracle_home and path environments inside the php file but this does not seem to be working. Close to giving up and looking to an alternative, i.e. ditching oci8, wondering is there any way to connect to oracle from php on a 64 bit setup? Thanks again for your suggestions.
                            • 11. Re: OCI8 IN WINDOWS SERVER 2008 x64
                              Instead of using the installer to install the "full" client, I suggest using the 32bit Oracle Instant Client, which is downloadable for free from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html

                              General installation instructions are at: http://www.oracle.com/technology/pub/notes/technote_php_instant.html
                              • 12. Re: OCI8 IN WINDOWS SERVER 2008 x64
                                Thanks again for the suggestions. Surprisingly it wasn't too difficult in the end to get it going. Only because all the hard work was done for me. I used the technique detailed here http://realfiction.net/go/153. Using symbolic links in system32 and syswow64. I never would have work this out.
                                • 13. Re: OCI8 IN WINDOWS SERVER 2008 x64
                                  That's good news. Thanks for sharing the link. I'll add a link to this thread from my IIS blog post.

                                  Update: I put a summary at: http://blogs.oracle.com/opal/2010/06/using_php_oci8_with_32-bit_php.html

                                  Edited by: cj2 on Jul 8, 2010 10:50 AM
                                  • 14. Re: OCI8 IN WINDOWS SERVER 2008 x64
                                    I have a Windows 2008 x64 server, with 11gR2 (64 bits) and PHP installed. In my case ZendServer 5.0.3. What I did is I replaced, in the ZendServer bin directory, the light dll (oraociicus11.dll) with the full dll of the 32 bit Instant Client (oraociei11.dll). I had to do this because the softlink approach did not work for me, and neither putting an entry in PATH to the 32 bit Instant Client. Maybe ZendServer behaves differently from PHP in this respect.

                                    My question is, I used to access the local DB (I need to access both a local DB and a remote one) without going through tnsnames.ora, e.g. like this ,

                                    $c = oci_connect('USER', 'PASS');

                                    this would connect me directly to the local DB. I cannot do this anymore, I have to give the local information as in $c = oci_connect('USER', 'PASS', '//localhost/SID');

                                    I tried to set the ORACLE_SID env var but that did not help. Will I not be able anymore to connect locally without the connection string in oci_connect?


                                    Edited by: francescom on Oct 4, 2010 1:45 AM
                                    1 2 Previous Next