无法加载动态库'C:\ xampp \ php \ ext \ php_oci8.dll'-%1不是有效的Win32应用程序 [英] Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application

查看:676
本文介绍了无法加载动态库'C:\ xampp \ php \ ext \ php_oci8.dll'-%1不是有效的Win32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动xampp服务器时出现此错误.

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

C:\ xampp \ php \ ext \ php_oci8.dll'-%1不是有效的Win32应用程序.

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

我下载了php_oci8-2.0.8-5.6-ts-vc11-x86并将php_oci8.dll提取到C:\xampp\php\ext目录中.

I downloaded php_oci8-2.0.8-5.6-ts-vc11-x86 and extracted php_oci8.dll into C:\xampp\php\ext directory.

此外,我下载了instantclient-basic-nt-12.1.0.2.0(32位版本)并将其添加到Windows的PATH变量中.

Also, I downloaded instantclient-basic-nt-12.1.0.2.0 (32 bit version) and added the same to the PATH variable of windows.

C:\OracleBasicClient\instantclient-basic-nt-12.1.0.2.0\instantclient_12_1已添加到PATH

仍然,我收到此错误,但不确定为什么会出现.

Still, I'm getting this error and not sure why it is coming.

我的Windows是64位.

My windows is 64 bit.

PHP信息(xampp)

PHP info (xampp)

系统 Windows NT 6.1(Windows 7专业版)i586
编译器 MSVC11(Visual C ++ 2012)
建筑 x86
线程安全已启用

System Windows NT 6.1 (Windows 7 Professional) i586
Compiler MSVC11 (Visual C++ 2012)
Architecture x86
Thread Safety enabled

我可能在做错什么,我该如何解决?

What am I possibly doing wrong and how can I fix it?

推荐答案

您的错误显示了内置类型的不匹配.

Your error shows a built-type mismatch.

请按照以下步骤解决它:

Resolve it by following these steps:

确保在以下位置下载并安装oracle instantclient :

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

  1. 记下您的 Oracle 数据库版本;对于Oracle数据库 12c 使用版本12.1.x ,对于 11g 版本使用版本11.1.x .
  2. 无论哪种情况,请确保下载Oracle InstantClient的 Basic Lite 版本.
  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.

之后,请在环境变量下的系统变量Path中添加Oracle InstantClient的位置.同样确保您同时具有 xampp 的PHP和 ext 的PHP并在其中进行设置(如果没有,请添加它们).

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).

然后,继续添加新的系统变量,并以 TNS_ADMIN 作为变量名称,并将 Oracle Instantclient的位置作为变量值.

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

还要用与 value 相同的 Oracle Instantclient位置定义用户变量 PATH .

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.

一旦打开,您可以打开 Windows命令提示符并运行 where oci * ,以确保您已正确定义环境变量;响应应如下所示:

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.

您现在可以进入php.ini文件(提供了明确定义的环境变量),并通过取消注释来启用您的 oci 扩展名(php_oci8.dll和php_oci8_11g.dll);您只需删除上述扩展名前的半列(; )即可实现.

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.

请记住保存php.ini文件,然后重新启动或启动您的Apache(如果尚未运行).

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

要检查您的PHP oci8配置是否已启用,您可以返回Windows命令提示符并运行: php --ri oci8 ;响应应类似于以下响应:

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

或者,您可以创建一个以<?php phpinfo(); ?>为内容的PHP文件,然后在浏览器中打开该文件并搜索oci8出现的位置.它也应该在那里显示启用.

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.

这篇关于无法加载动态库'C:\ xampp \ php \ ext \ php_oci8.dll'-%1不是有效的Win32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆