Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application

前端 未结 2 593
你的背包
你的背包 2021-01-03 09:25

I am getting this error when I start my xampp server.

C:\\xampp\\php\\ext\\php_oci8.dll\' - %1 is not a valid Win32 application.

<
相关标签:
2条回答
  • 2021-01-03 10:06

    It seems that you downloaded the DLL for a different architecture and pointed to it in your php.ini, instead of using the bundled DLL and simply un-commenting the default entry in php.ini.

    I just downloaded the same version, XAMPP 3.2.2 x86, with PHP 7.1, and it ships with the DLL file that you need, which is installed to C:\xampp\php\ext\php_oci8_12c.dll.

    You appear to have done everything else correctly.

    To fix the issue, ensure that the effective php.ini (by default, C:\xampp\php\php.ini) references only the default file (remove the erroneous entry you added for php_oci8.dll), like so:

    extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client
    

    Restart Apache and the problem should be resolved.

    0 讨论(0)
  • 2021-01-03 10:09

    Your error shows a built-type mismatch.

    Resolve it by following these steps:

    Make sure you download and install oracle instantclient at: http://www.oracle.com/technetwork/topics/winsoft-085727.html, but note:

    1. Take note of your Oracle database version; use Version 12.1.x for Oracle database 12c and Version 11.1.x for 11g releases.
    2. In either case, make sure you download the Basic Lite version of the Oracle instantclient.

    After that, do add location of your Oracle instantclient to your System variable Path under your Environment Variables. Do equally ensure that you have both the PHP of your xampp and its ext available and set there as well (if not, do add them).

    Then, proceed to add a new System variable with TNS_ADMIN as variable name and the location to Oracle instantclient as variable value.

    Also, define your User variables PATH with the same the location to Oracle instantclient as value.

    After this stage, restart your computer for a full propagation of the newly defined environment variables.

    Once on, you may open your Windows Command Prompt and run where oci* to ensure that you had your environment variables well defined; the response should look like this:

    C:\Users\flex>where oci*
    
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.dll
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.sym
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\ociw32.dll
    C:\instantclient_11_2\oci.dll
    C:\instantclient_11_2\oci.sym
    C:\instantclient_11_2\ocijdbc11.dll
    C:\instantclient_11_2\ocijdbc11.sym
    C:\instantclient_11_2\ociw32.dll
    C:\instantclient_11_2\ociw32.sym
    

    If not, your must have missed something and need to revisit the process, ensuring to completing it effectively.

    You may now proceed to your php.ini file (provided environment variables are well defined) and enable your oci extensions (php_oci8.dll and php_oci8_11g.dll) by uncommenting them; you can achieve that by simply removing the semi column (;) before the said extensions.

    Do remember to save your php.ini file, then, restart or start your apache if it isn't already running.

    To check your PHP oci8 configurations are enabled, you may go back to your Windows Command Prompt and run: php --ri oci8; the response should be similar to the one below:

    C:\Users\flex>php --ri oci8
    
    OCI8 Support => enabled
    OCI8 DTrace Support => disabled
    OCI8 Version => 2.1.1
    Revision => $Id: 86f22a208f89dcd5b305e82929a7429683968b11 $
    Oracle Run-time Client Library Version => 11.2.0.4.0
    Oracle Compile-time Instant Client Version => 10.2
    
    Directive => Local Value => Master Value
    oci8.max_persistent => -1 => -1
    oci8.persistent_timeout => -1 => -1
    oci8.ping_interval => 60 => 60
    oci8.privileged_connect => Off => Off
    oci8.statement_cache_size => 20 => 20
    oci8.default_prefetch => 100 => 100
    oci8.old_oci_close_semantics => Off => Off
    oci8.events => Off => Off
    
    Statistics =>
    Active Persistent Connections => 0
    Active Connections => 0
    

    Alternatively, you can create a PHP file with <?php phpinfo(); ?> as content, then open it in your browser and search for oci8 occurrences; it should show enabled there as well.

    0 讨论(0)
提交回复
热议问题