php 如何在 xampp 5.6.3 中启用 oci?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29009665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:12:13  来源:igfitidea点击:

How to enable oci in xampp 5.6.3?

phpdllxamppoci8

提问by Harshrossi

I am facing some issue while starting Apache server via XAMPP. I have installed XAMPP Version 5.6.3.

我在通过 XAMPP 启动 Apache 服务器时遇到了一些问题。我已经安装了 XAMPP 版本 5.6.3。

When I start the Apache server from xampp control panel, an error message is displayed as shown below:

当我从 xampp 控制面板启动 Apache 服务器时,显示一条错误消息,如下所示:

Figure-1

图1

On clicking 'OK' button, another dialog box is displayed as shown:

单击“确定”按钮后,将显示另一个对话框,如下所示:

Figure-2

图2

The thing is I wanted to use OCI instead of mysql. so I have commented out the mysql extensions and uncommented the OCI extension in php.inifile.

问题是我想使用 OCI 而不是 mysql。所以我在php.ini文件中注释掉了 mysql 扩展并取消了 OCI 扩展的注释。

Figure-3

图 3

The php_oci8_12c.dllfile is the only file available in the extensions (ext) folder of php in xampp. Hence I included the line in the php.ini as shown in the above image.

php_oci8_12c.dll文件在XAMPP的PHP扩展(EXT)文件夹中唯一可用的文件。因此,我在 php.ini 中包含了如上图所示的行。

Since then I am getting this error.

从那以后我收到了这个错误。

I have installed instant client 12.1 as well but no luck. I also tried copying the OCI.dll from instantclient_12_1 and pasting it in c:/xampp/php and c:/xampp/apache/bin. The error still persists.

我也安装了即时客户端 12.1,但没有运气。我还尝试从instantclient_12_1 复制OCI.dll 并将其粘贴到c:/xampp/php 和c:/xampp/apache/bin。错误仍然存​​在。

Need help..

需要帮忙..

UPDATE:I removed other oracle paths in PATH of environment variables, keeping only the instantclient path. Now I am getting this error..

更新:我删除了环境变量 PATH 中的其他 oracle 路径,只保留了 Instantclient 路径。现在我收到这个错误..

Figure-4

图 4

采纳答案by Harshrossi

I solved the issue. The problem was that I was trying to use a 64 bit DLL(php_oci8_12g.dll) in a 32 bit PHP. I downloaded a 32 bit instantClient and it works now! :-)

我解决了这个问题。问题是我试图在 32 位 PHP 中使用 64 位 DLL(php_oci8_12g.dll)。我下载了一个 32 位的 InstantClient,现在可以使用了!:-)

instantclient-basic-nt-12.1.0.2.0.zip

Instantclient-basic-nt-12.1.0.2.0.zip

回答by Pablo Lopes

Well, I've installed XAMPP 1.8.2, PHP 5.4 and Apache 2.0, and I use php_oci8_11g.dll and works fine.

嗯,我已经安装了 XAMPP 1.8.2、PHP 5.4 和 Apache 2.0,我使用 php_oci8_11g.dll 并且工作正常。

You are trying use php_oci8_12g.dll, I recommend you read this link http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-12c-2088811.htmlwith especifications for run oci12g.

您正在尝试使用 php_oci8_12g.dll,我建议您阅读此链接http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-12c-2088811.html,其中包含运行 oci12g 的详细说明。

回答by GDelfs

I had a problem related to OCI8 and XAMPP for days in a row, the problem was shown as:

我连续几天遇到与 OCI8 和 XAMPP 相关的问题,问题显示为:

Fatal error: Call to undefined function oci_connect()

致命错误:调用未定义的函数 oci_connect()

I was able to correct it using the php that comes by default with XAMPP. I'm using windows 10 64 bits as well, but used xampp-win32-7.3.2-0-VC15 (php 7.3.2). To summarize, I was able to get a correct configuration by doing everything with 32 bits versions (except the o.s). The full story and how I've done it:

我能够使用 XAMPP 默认附带的 php 更正它。我也在使用 windows 10 64 位,但使用了 xampp-win32-7.3.2-0-VC15 (php 7.3.2)。总而言之,通过使用 32 位版本(操作系统除外)执行所有操作,我能够获得正确的配置。完整的故事以及我是如何做到的:

If you go to your xampp/php directory through cmd, in my case it was "C:\xampp\php", and start the php by the simple command "php" it will probably show what dlls are not being found in the etc folder or which of those are not Win 32 compatible. If you get this problem, you will not be able to see the OCI8 page when opening a phpinfo() page:

如果你通过 cmd 进入你的 xampp/php 目录,在我的例子中它是“C:\xampp\php”,并通过简单的命令“php”启动 php,它可能会显示在 etc 中找不到什么 dll文件夹或其中哪些与 Win 32 不兼容。如果遇到这个问题,打开phpinfo()页面时将看不到OCI8页面:

enter image description here

在此处输入图片说明

If that's the case, with win 32 compatibility problems or not finding the dlls that you are certain are there, you should unistall XAMPP and reinstall it using a x32 version. The phpinfo page will show x86 Architecture. Remember to remove in the path variables any source that miss locate your php in use, the point here is to use the one given by default in XAMPP. If you need by any reason to use another php installation, remember to use x86 architecture. If you need an updated OCI8 dll you can download it on https://pecl.php.net/package/oci8, but remember to check the Thread Safety compatibility, you can find it on your phpinfo page as well. In my case it was enough to use the one provided by XAMPP.

如果是这种情况,win 32 兼容性问题或找不到您确定存在的 dll,您应该卸载 XAMPP 并使用 x32 版本重新安装它。phpinfo 页面将显示 x86 架构。请记住在路径变量中删除任何未找到正在使用的 php 的源,这里的重点是使用 XAMPP 中默认提供的源。如果您出于任何原因需要使用其他 php 安装,请记住使用 x86 架构。如果您需要更新的 OCI8 dll,您可以在https://pecl.php.net/package/oci8上下载它,但请记住检查线程安全兼容性,您也可以在您的 phpinfo 页面上找到它。就我而言,使用 XAMPP 提供的就足够了。

After this, you have to enable the extension:

在此之后,您必须启用扩展:

 extension=oci8_12c

in the php.ini configuration file. It was enough for me to enable only this one, although some people suggests to also enable extension=pdo_oci. My suggestion is to try this only if you failed to install with the path here shown. It's also good to check if you are set in the correct path regarding the extensions, in my case:

在 php.ini 配置文件中。我只启用这个就足够了,尽管有些人建议也启用 extension=pdo_oci。我的建议是仅当您使用此处显示的路径安装失败时才尝试此操作。检查您是否设置了有关扩展的正确路径也很好,在我的情况下:

extension_dir="C:\xampp\php\ext"

After this, you have to download the Oracle Instant Client. Since you are using x86 architecture (you must use this one), you need to find a 32-bit version of the OIC, but is also important to check which one is compatible with the extension you uncommented. In my case, of oci8_12c, it was instantclient-basic-nt-12.2. The final step is to unzip it to a folder, like "C:\instantclient_12_2" and add it to the path variables of the system. Reload apache and check if the OCI8 is shown correcly.

在此之后,您必须下载 Oracle Instant Client。由于您使用的是 x86 架构(您必须使用这个架构),您需要找到 OIC 的 32 位版本,但检查哪一个与您取消注释的扩展兼容也很重要。就我而言,oci8_12c 是 Instantclient-basic-nt-12.2。最后一步是将其解压缩到一个文件夹中,例如“C:\instantclient_12_2”并将其添加到系统的路径变量中。重新加载 apache 并检查 OCI8 是否正确显示。

回答by Himanshu Dixit

I solved the issue after stuck 2-3 days .

我在卡住 2-3 天后解决了这个问题。

Before follow steps Some things to remmember . 1- I am using win 8.1 64 bit . 2- Using Xampp 5.6.31 32 bit . 3- Using instaclient 12.2.0.1 64 bit (Because my win 8.1 is 64 Bit ) .

在按照步骤操作之前要记住的一些事情。1- 我使用的是 win 8.1 64 位。2- 使用 Xampp 5.6.31 32 位。3- 使用 instaclient 12.2.0.1 64 位(因为我的 win 8.1 是 64 位)。

Now steps are below -

现在步骤如下 -

Step 1 - Download xampp 5.6.31 32 bit and install it .

步骤 1 - 下载 xampp 5.6.31 32 位并安装它。

Step 2 - Download and install oracle 11g R2

第 2 步 - 下载并安装 oracle 11g R2

Step 3 - Download and install OTN (oracle instaclient 12.2.0.1 )

第 3 步 - 下载并安装 OTN(oracle instaclient 12.2.0.1)

  • Extract all files in any drive in my case i have extract in C:\oracle\instaclient12.2.0.1
  • Add (C:\oracle\instaclient12.2.0.1) it to the path variables of the system. and also add new variable under variable of system with name TNS_ADMIN and put same path (C:\oracle\instaclient12.2.0.1) in its value .
  • Its time to set PHP.INI here uncomment following (see image below) PHP.ini setup
  • Copy 3 files from C:\oracle\instaclient12.2.0.1oci.dll,oraociei12.dll and oraons.dll to xampp apache\bin . by this step Unable to load dynamic library issue has been resolved . Unable to load dynamic library issue solution
  • Now restart Apache on xampp and check info.php on browser . OCI8 module will appear there enable .
  • 在我的情况下,提取任何驱动器中的所有文件我在C:\oracle\instaclient12.2.0.1 中提取
  • 将(C:\oracle\instaclient12.2.0.1)添加到系统的路径变量中。并在名称为 TNS_ADMIN 的系统变量下添加新变量,并在其值中放置相同的路径(C:\oracle\instaclient12.2.0.1)。
  • 是时候在此处设置 PHP.INI 取消注释以下(见下图) PHP.ini 设置
  • C:\oracle\instaclient12.2.0.1oci.dll、oraociei12.dll 和 oraons.dll 中的3 个文件复制到 xampp apache\bin 。通过这一步无法加载动态库问题已解决。 无法加载动态库问题解决方法
  • 现在在 xampp 上重新启动 Apache 并在浏览器上检查 info.php。OCI8 模块会出现在那里 enable 。

Enjoy !!!.

享受 !!!。