Hi all,

I'm having difficulty writing a basic script connecting me to an Oracle database.

I've tried various connection scripts but always seem to get an error along the lines of,

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

I'm using an IIS web server and know that I have php installed successfully.

I've also set up a ODBC data source, which I believe connects to my database successfully.

Does anyone know where i'm going wrong?

Thanks in advance,

Nick

    Whenever I use a connection string similar to the following,

    OCILogon("$user", "$PASSWORD", "$connect_string");

    I always get the error message,

    "Fatal error: Call to undefined function: ocilogon() in c:\inetpub\wwwroot\test2.php on line 5..."

    I'm using IIS as my webserver, is this the problem?

      Your copy of PHP doesn't know what the function 'ocilogon' is. Either you have spelt it wrong - and you need to check the case - or you don't have oracle support in your PHP setup. Do the ole phpinfo() thing to find out if you have oracle support.
      Put

      <?php phpinfo() ?>

      in a page all by itself and call the page. You'll get lots of usefull info. If there is nothing there about Oracle, you don't have it. How to get it in there is another question...

        Can't see anything sayin that oracle support is enabled...

        Any idea's how to enable this?

        Cheers,

          in the php.ini file there are 2 lines in the windows extentions section about half way down the file

          ;extension=php_oci8.dll
          ;extension=php_oracle.dll

          the oci8 is for version 8 and above, the oracle.dll is for anything below 8.

          you need to uncommect (remove the semi-colon) from the appropriate dll file to activate the module functons.

          see here

            Ok...

            So i've uncommented the "extension=php_oci8.dll" file from the "php.ini" file.

            Now when I try to run my php file i'm getting the following error...

            "PHP Warning: Unknown(): Unable to load dynamic library './php_oci8.dll' - The specified module could not be found. in Unknown on line 0"

            Any ideas?

            Cheers for all the help guys,

            Nick

              either the path to the library file is wrong, check your ini file or you can try copying the oci8.dll to the system32 folder...the file should be in the php folder>extentions

                I've done a search for the oc8i.dll file but it doesn't seem to exist?

                The only files i'm finding are mtxoci8.dll and orajox9oracle_jdbc_oci8.dll.

                Do these mean anything to you?

                If so, in what file do set the path to target the oci8.dll file... In the php.ini file?

                  just above the big list of windows extentions is this section
                  ;;;;;;;;;;;;;;;;;;;;;;;;;
                  ; Paths and Directories ;
                  ;;;;;;;;;;;;;;;;;;;;;;;;;

                  ; UNIX: "/path1:/path2"

                  ;include_path = ".:/php/includes"
                  ;
                  ; Windows: "\path1;\path2"
                  ;include_path = ".;c:\php\includes"

                  ; The root of the PHP pages, used only if nonempty.
                  doc_root =

                  ; The directory under which PHP opens the script using /~usernamem used only
                  ; if nonempty.
                  user_dir =

                  ; Directory in which the loadable extensions (modules) reside.
                  extension_dir = ./ is the section to update

                  with the path to the extentions folder in the php folder

                  hth

                    I've added the path to the php directory but there's no extention directory within there. The script now looks like this,

                    ; Directory in which the loadable extensions (modules) reside.
                    extension_dir = "D:\Program Files\php"

                    Is this correct?

                    I'm still getting the same error message. :-)

                      you might need to put a slash at the end to singify it is a folder...

                      also, in that folder is a folder called "extensions", in there is the oracle 8 dll file called php_oci8.dll

                      try copying this to the system32 folder on your c: drive

                        There's no folder called 'extensions' in my php folder. Just the folders,

                        uploadtemp,
                        sessiondata,
                        BACKUP.

                          I'm begining to think that i have the wrong version of PHP installed.

                          The version I installed was PHP 4.3.4 Installer version which was .exe file without any manual configuration. Looking at the install.txt file, it states that "this version doesn't install any extentions or server api..."

                          Do I need to download a different version?

                            yeah, better try downloading a fuller version

                              I've installed the fuller version and seem to have all the directories and extentions mentioned above. I've configured the files mentioned above and now when I run a .php file i get the folllowing error,

                              Unknown(): Unable to load dynamic library 'C:\php\extensions\php_oci8.dll' - Access is denied.

                              I know it's nothing to do with access rights as I have administrative rights on my machine.

                              Does the current PHP version support Oracle 9i, all the documentation seems to refer to Oracle 8?

                                have you copied the .dll file over and changed the .ini file to reflect the path?

                                  In the php.ini file the only changes i've made are to define the extensions folder,

                                  ; Directory in which the loadable extensions (modules) reside.
                                  extension_dir = "C:\php\extensions\"

                                  And to uncomment the extension=php_oci8.dll but.

                                  Haven't copied any .dll files anywhere, should I be?

                                    copied the php_oci8.dll file into the system32 directory. No luck, still getting the 'access is denied' error.

                                    Bet your running out of idea's here mate, might be easier for me to start learning another scripting language!

                                      Write a Reply...