Hello,

I have installed php4 within IIS on a win32 platform (not my choice). Now i like to call my Oracle database with the OCI functions from PHP4. Because i don't have a C compiler i took a precompiled php_oci8.dll from the internet and placed it in my winnt\system32 directory and changed my extension settings in my php.ini file.

extension_dir=c:\winnt\system32
extension=php_oci8.dll

When i try to logon with the OCIPLogon function i get the following error message:

Fatal error: Call to undefined function: ociplogon().

Can someone tell me how to install the php_oci8.dll correctly?

Thanx, Albert

    8 days later

    Hi,
    Sorry for not answering you what you are looking for, because iยดm trying to do the same. But please, could you tell me where did you find the php_oci8.dll?

    Thanks
    Sergio

    P.D. may be this address could help both of us
    http://pulsar.jb.com/sklar-php/code83.html

      5 days later

      I am also looking for a copy of php_oci8.dll for PHP4... If I can get a copy of this precompiled DLL, I'm sure it would be easier for all of us to figure out any issues with installing/configuring this PHP extension. I'm running Apache 1.3.12 on NT 4.0 (SP5) with PHP 4.0.1 PL2. PHP runs like a champ but without the oci dll, no oracle connection ๐Ÿ™ Hey, even if I got source code, I would TRY (emphasis on try) compiling it. Worth a shot.

        I think the trick is to have oci.dll, which comes with Oracle8i, in the PHP directory. Am I correct???

          Yes, there is mention of having the oci.dll together with the compiled php_oci8.dll. I believe that is a must... however, I'm having trouble getting the php_oci8.dll (or even php_oracle.dll for that matter) to load correctly within my php4.0.1pl2 installation. When I copy the dlls into my extenstions directory (same dir as php.exe) and then add the appropriate "extension=php_oci8.dll" line to my php.ini file (in the WINNT directory), I get an error message from php4ts.dll (I'm running under Apache 1.3.12). PHP.EXE hangs in memory (cannot terminate in the task list).

          But, if I re-comment the extension line out, then PHP runs okay. All I'm calling in my test page is phpinfo(). Perhaps I need some additional section code specifically for the oracle extensions, but not sure.

          I did notice that certain parts of PHP are VERY version specific... I downloaded an earlier Beta of Zend Optimizer, and when I added this to my php.ini, I got a similar (though not exactly the same) error message. But, once I got a new version of the optimizer, and installed it in the same manner, it ran fine.

          I'm coming to the conclusion that in order to get this stuff to work right, you need either 1) a pre-compiled version of php_oci8.dll that is compiled with a particular version of php (when they release subsequent win32 binaries), or 2) re-compile the whole thing yourself.

          I do have the latest source code for the php_oci8 extension, so I'm going to TRY (much emphasis) compiling everything myself, and see where that goes.

          Anyone else think of other things to try?

            Any success in getting PHP4+ApacheWin32+OCI working. Please keep us posted. Best of luck to you Andy :-)

              I'll let ya know... I'm in the middle of trying to get my devel environment right (with SQL*Net, etc.)... unfortunately, looks like the easiest way to get these compiled is with MS VC++, but I don't have a copy (probably going to order it tomorrow ๐Ÿ™‚)

              But I'll be trying this with Borland Compiler 5.5 (free version) and also with Cygwin (to see which one may work better) and I'll certainly keep you all posted.

              Ah, to be digging through hardline code once again!

                15 days later

                Here are a part of a script you must insert in the first Lines of your Script:
                dl("php_oci8.dll"); //important
                putenv("ORACLE_SID=orcl"); //important
                $conn=ocilogon("Scott","Tiger");

                I hope it will help you,

                Karsten

                  It still doesn't work.

                  I've placed the PHP-files in C:\WINNT\PHP, have my Oracle 8.1.6 DB installed on the same server.

                  Then I've placed the PHP.INI file in C:\WINNT\ and made sure the following 2 lines were included:
                  extension_dir = ./ (also tried ./winnt/php)
                  extension = php_oci8.dll (also tried without)
                  extension = oci.dll (also tried without)

                  Off course I restarted the IIS-service with:
                  net stop iisadmin
                  net start w3svc

                  Finally tried this script:
                  <BODY>
                  <?php
                  print("Test...");
                  dl("php_oci8.dll");
                  putenv("ORACLE_SID=ORCL");
                  $c1 = ocilogon("SCOTT","TIGER");
                  $stmt = ociparse($c1, "select * from dual");
                  ociexecute($stmt);
                  ?>
                  </BODY>

                  which produced this output:
                  Test...
                  Fatal error: Unable to load dynamic library './/php_oci8.dll'
                  The specified module could not be found.

                  I also tried to replace the dl("php_oci8.dll) with ("oci.dll") which resulted in:
                  Test...
                  Warning: Invalid library (maybe not a PHP library) 'oci.dll' in Unknown on line 0

                  Fatal error: Call to undefined function: ocilogon() in ...

                  So, I guess it's some wrong compiled library.
                  Anybody figures what is going wrong?
                  Thanks in advance,
                  Walter

                    4 days later

                    hi all,
                    I encountered the same problem too...sigh
                    So, at last , I recompiled all the PHP4.0.1pl2 under the instruction from php doc. The compilation seems has some tiny
                    warning, but it done at last...:-).
                    The first compilation is a Debug_TS version, which work ok with OCI8. The configuration is something like this:
                    extention=php_oci8.dll
                    extention_dir=f:\php-4.0.1pl2\Debug_TS
                    The phpinfo() show the correct result-- oci8
                    supported. Then I tried the PHPLIB7.2b which
                    use db_oci8.inc as the CT_Sql , it work ok.
                    the DB_Example class has a database "oracle151" which is the service name of my oracle server net8 configure.No
                    ORACLE_SID needed at my client side.

                    Then , I tried to recompiled all into a
                    Release version. But....After all compilation
                    done, and fix the httpd.conf and php.ini,
                    the same error appeared again!....
                    TNS error : service can't resolve
                    ( some matter like this :-( )
                    seems that the php_oci8.dll can't not pass
                    the correct service name to oci8.dll....
                    then , I tried to ommit the database in DB_Example(just let it empty),then php CAN
                    connect to my local oracle server ....ODD!!..

                    SIGH....I tried to add some message in the
                    oci8.c to see whether the corrected string has been passed? It does. Nothing ODD in the
                    oci8.c code...(??!!)..
                    At last , the results are:
                    1. PHP4.0.1pl2 Debug_TS version all goes well.
                    2. PHP4.0.1pl2 Release_TS version only can
                    do with empty service name.( NO REMOTE server
                    support!??)

                    Maybe the thread safe feature can't work
                    well with OCI8.dll ???

                    Sorry for my UGLY English...

                      Karsten, thanks for the tip ๐Ÿ™‚

                      Well, I've finally located a pre-compiled version of PHP on the web WITH most of the dlls attached (including OCI and a host of others) - this is a 4.0.2dev compilation so be wary.

                      http://www.mm4.de/andreas.otto/php_related

                      I'm still having some trouble with the php_oci8.dll however. I get all my other fun extensions working simply from the supplied dlls (ftp, ldap, zlib), but as soon as I un-comment "extension=php_oci8.dll" in my php.ini, my Apache server craps out (PHP hangs as a process in memory).

                      My extensions dir is the same as php.exe (c:\phpdev). I've copied the supplied oci.dll into that same directory. I've also copied the supplied php_oci8.dll into my system32 directory (got a tip on this from the php-windows list on php.net). Apache 1.3.12 on NT 4 SP5 as CGI (not apache module).

                      So, do I need something else? I don't have oracle installed locally, but up on a network drive... should I have something added to my path to point to this oracle installation? Do I need some additional settings in my include_path of php.ini? Am I missing some [section] code specific to OCI8? Any answers would help.... specifically, if anyone HAS gotten php_oci8.dll to work, specifically how are your files setup (directory locations, etc.)? Hope to get this all worked out soon, and get on with development work ๐Ÿ™‚

                        19 days later

                        Hi folks,

                        Any luck with this?

                        I just checked the latest dlls from php4win.de and Apache still gives a GPF when try to load php as a module with oci extension activated.

                        Regards

                          As we've worked this through here 8 ways from Sunday... there are a few KEY points which you need to check to get the oci8 extension to work correctly, in either CGI or Apache mod mode.

                          1) MOST IMPORTANT: you must have the latest version of the oracle client software installed on the server... Oracle Client 8.1.6 is what was used when compiling the php_oci8.dll. The extension is very specific to this version of client drivers/software. This is a free (though VERY BIG) download from technet.oracle.com (~170 M๐Ÿ˜Ž.

                          2) Are you using the full set of files from php4win.de? Again, extensions are also specific to a compiled version of php4... if you want to use their php_oci8, then you also have to run THAT compiled version of php4.0.2dev. Also, bear in mind that this is a development compilation, not a production release.

                          3) Can you connect to your oracle database through other software, such as ODBC... also, can you successfully test your database connection inside Net8? This will help to narrow any problems you're having down to either oracle itself, or to php4/apache/php_oci8.

                            Can I recompile php_oci8.dll to make it run with my OCI 8.0.5 ?

                            If yes, where can I find the source code (for MS VC++) ?

                            thx

                              The source code for all php extensions SHOULD be available through the main php CVS repository. Check on php.net. I'm not sure if the php_oci8.dll can be recompiled for different oracle clients, but it might be worth a try. I don't recompile this myself... I use the compiled binaries available at www.php4win.de (these gents recompile the source code for win32 at every CVS release - currently working with php4.0.2dev). They compile the php_oci8 for oracle 8.1.6, and I'm not sure if the compile works under 8.0.5 - a question better asked of them (they have a contact form on their web page).

                              As far as I've seen, besides the long BIG download, there's no major reason not to install the 8.1.6 client, as it should connect without difficulty to all previous versions of oracle database servers. And it's free. Any significant reason not to upgrade? (like to know, as I get quite a few questions re: oracle client and php)

                                Any significant reason not to upgrade?

                                None, except "the big download" vs. a crap 64K line...

                                  Thanks for your information,

                                  Did all you described, and finally the php_oci8.dll is enabled. Except.....

                                  I can\'t logon. PHP is returning the ORA-message that my credentials are wrong, while using the same connection parameters (scott/tiger@db_alias) as with my PHP/ODBC connection (which works).

                                  Do you recognise this problem?

                                    What is the full readout of the error message (ORA # and text of message)? Also, can you do a test connection within Net8 to your database? One thing to try, put your connection information in all lowercase (sid, username, password). Another, what does you ocilogon call look like (post a cleaned version, without sensitive data)?

                                    With this info, we should be able to track things down further.

                                      What is the full readout of the error message (ORA # and text of message)?
                                      Also, can you do a test connection within Net8 to your database? One thing
                                      to try, put your connection information in all lowercase (sid, username,
                                      password). Another, what does you ocilogon call look like (post a cleaned
                                      version, without sensitive data)?

                                      With this info, we should be able to track things down further.

                                      Here are my ORA messages together with my php script. I can connect to my Oracle 8.1.6 database with net8 (using SQL*Plus).

                                      ORA Messages

                                      Warning: _oci_open_server: ORA-12638: Credential retrieval failed in C:\Inetpub\Homepage\oci.php on line 10

                                      Warning: Supplied argument is not a valid OCI8-Connection resource in C:\Inetpub\Homepage\oci.php on line 11

                                      Warning: Supplied argument is not a valid OCI8-Statement resource in C:\Inetpub\Homepage\oci.php on line 12

                                      Warning: Supplied argument is not a valid OCI8-Statement resource in C:\Inetpub\Homepage\oci.php on line 13

                                      PHP script

                                      <head>
                                      <title>Homepage</title>
                                      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                                      </head>

                                      <body bgcolor="#ffffff" marginwidth="10" marginheight="10">

                                      <?php
                                      $c1 = ociplogon("scott", "tiger", "alias");
                                      $stmt = ociparse($c1, "select * from links order by link");
                                      ociexecute($stmt);
                                      while(ocifetch($stmt))
                                      printf("<P>".ociresult($stmt, "link")."</P>\n");
                                      ?>

                                      </body>