Forum Stats

  • 3,757,165 Users
  • 2,251,204 Discussions
  • 7,869,748 Comments

Discussions

PHP 7.2-Oracle connection

user9141128
user9141128 Member Posts: 4
edited Feb 7, 2020 4:49AM in PHP

Hello,

having trouble to get PHP 7.2 connected to oracle, I followed the instructions shown in:

https://blogs.oracle.com/opal/installing-xampp-for-php-and-oracle-database

I think I downloaded exactly the versions of xampp and oracle-instantclient that are used there.

Still, i don't have the oci-parts shown in phpinfo.

Both php and instantclient are 32 bit (windows itself is 64 bit, but I understand that this is no problem?).

I read that the VC-version is important, must match between php and the instantclient? Is that correct?

PHP is vc15, instant-client is vc14. Could this be the cause for the problem?

unfortunately, I can't find PHP with vc14, and I can't find an instant-client with vc15.

Can anyone help?

Best Answer

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,782 Bronze Crown
    edited Jan 23, 2020 2:32AM

    Are the oci8 libraries in the php.ini exension_dir, both for php and the xamp equivalent?

    Running php from the command line the php php.ini extension_dir needs setting, as well as uncommenting or adding the relevant "extension=" for the correct version of oci8 dll for what ever version db you are trying to connect to. Also make sure you have set TNS_admin in the xamp env so the tnsnames.ora can be found.

  • user9141128
    user9141128 Member Posts: 4
    edited Jan 23, 2020 7:03AM

    Hi, Thanks for replying.

    - extension dir is: C:\\xampp\php\ext

    - the line in the php.ini is: extension_dir="C:\\xampp\php\ext".

    I created an system-environment-variable:

    TNS-ADMIN: C:\oracle\instantclient_12_2

    There is a tnsnames.ora in that folder.

    Starting PHP in command line, i get:

    C:\xampp\php>php

    PHP Warning: PHP Startup: Unable to load dynamic library 'oci8_12c' (tried: C:\xampp\php\ext\oci8_12c (Das angegebene Modul wurde nicht gefunden.

    ), C:\xampp\php\ext\php_oci8_12c.dll (Das angegebene Modul wurde nicht gefunden.

    )) in Unknown on line 0

    As I understand, there is only one dll related to oracle (php_oci8_12c.dll). This dll does exist in C:\xampp\php\ext\.

    The part "...in unknown on line 0" seems to mean that the dll is found, but there is an error inside of the dll.

    Anything else I can do?

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,782 Bronze Crown
    edited Jan 23, 2020 7:43AM
    Hi, Thanks for replying.

    You are are very welcome.

    - extension dir is: C:\\xampp\php\ext- the line in the php.ini is: extension_dir="C:\\xampp\php\ext".

    Why the two \'s?

    I created an system-environment-variable:TNS-ADMIN: C:\oracle\instantclient_12_2

    The env var needs to be "TNS_ADMIN", and underscore not a dash.

    C:\xampp\php>phpPHP Warning: PHP Startup: Unable to load dynamic library 'oci8_12c' (tried: C:\xampp\php\ext\oci8_12c (Das angegebene Modul wurde nicht gefunden.), C:\xampp\php\ext\php_oci8_12c.dll (Das angegebene Modul wurde nicht gefunden.)) in Unknown on line 0

    Have you copied the dll to that directory?... as that is where php is expecting it according to the error message., as the English translation states "The specified module was not found."

  • user9141128
    user9141128 Member Posts: 4
    edited Jan 31, 2020 2:46AM

    Hi,

    thanks again.

    TNS_ADMIN, of course, not TNS-ADMIN. Unfortunately a mistake only in my post. The variable is defined correctly..

    Same with extension_dir="C:\\xampp\php\ext", which of course is extension_dir="C:\xampp\php\ext"

    (changing the extension_dir to an invalid path causes a much longer list of errors).

    The php_oci8_12c.dll is stored in the right directory (C:\xampp\php\ext).

    (To be sure, i removed php_open_ssl.dll, which I also include,  from that directory, and got the cooresponding additional error when starting php)

    Which means, the problem is still unsolved.

  • user9141128
    user9141128 Member Posts: 4
    edited Feb 7, 2020 4:49AM Accepted Answer

    Problem (finally) solved by installing a different oracle-client ( https://www.oracle.com/database/technologies/dotnet-utilsoft-downloads.html).

    (As expected, the not-fount-error-message seems to be just a standard-message for 'something's wrong')