简体   繁体   English

如何在 xampp 5.6.3 中启用 oci?

[英]How to enable oci in xampp 5.6.3?

I am facing some issue while starting Apache server via XAMPP.我在通过 XAMPP 启动 Apache 服务器时遇到了一些问题。 I have installed XAMPP Version 5.6.3.我已经安装了 XAMPP 版本 5.6.3。

When I start the Apache server from xampp control panel, an error message is displayed as shown below:当我从 xampp 控制面板启动 Apache 服务器时,显示一条错误消息,如下所示:

图1

On clicking 'OK' button, another dialog box is displayed as shown:单击“确定”按钮后,将显示另一个对话框,如下所示:

图2

The thing is I wanted to use OCI instead of mysql.问题是我想使用 OCI 而不是 mysql。 so I have commented out the mysql extensions and uncommented the OCI extension in php.ini file.所以我已经注释掉了 mysql 扩展并在php.ini文件中取消了 OCI 扩展的注释。

图 3

The php_oci8_12c.dll file is the only file available in the extensions (ext) folder of php in xampp. php_oci8_12c.dll文件是 xampp 中 php 的扩展 (ext) 文件夹中唯一可用的文件。 Hence I included the line in the php.ini as shown in the above image.因此,我在 php.ini 中包含了如上图所示的行。

Since then I am getting this error.从那以后我收到了这个错误。

I have installed instant client 12.1 as well but no luck.我也安装了即时客户端 12.1,但没有运气。 I also tried copying the OCI.dll from instantclient_12_1 and pasting it in c:/xampp/php and c:/xampp/apache/bin.我还尝试从instantclient_12_1 复制OCI.dll 并将其粘贴到c:/xampp/php 和c:/xampp/apache/bin。 The error still persists.错误仍然存​​在。

Need help..需要帮忙..

UPDATE: I removed other oracle paths in PATH of environment variables, keeping only the instantclient path.更新:我删除了环境变量 PATH 中的其他 oracle 路径,只保留了 Instantclient 路径。 Now I am getting this error..现在我收到这个错误..

图 4

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

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.问题是我试图在 32 位 PHP 中使用 64 位 DLL(php_oci8_12g.dll)。 I downloaded a 32 bit instantClient and it works now!我下载了一个 32 位的 InstantClient,现在可以使用了! :-) :-)

instantclient-basic-nt-12.1.0.2.0.zip Instantclient-basic-nt-12.1.0.2.0.zip

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 . 1- 我使用的是 win 8.1 64 位。 2- Using Xampp 5.6.31 32 bit . 2- 使用 Xampp 5.6.31 32 位。 3- Using instaclient 12.2.0.1 64 bit (Because my win 8.1 is 64 Bit ) . 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在我的情况下,提取任何驱动器中的所有文件我在C:\\oracle\\instaclient12.2.0.1 中提取
  • Add ( C:\\oracle\\instaclient12.2.0.1 ) it to the path variables of the system.将( C:\\oracle\\instaclient12.2.0.1 )添加到系统的路径变量中。 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 .并在名称为 TNS_ADMIN 的系统变量下添加新变量,并在其值中放置相同的路径( C:\\oracle\\instaclient12.2.0.1 )。
  • Its time to set PHP.INI here uncomment following (see image below) PHP.ini setup是时候在此处设置 PHP.INI 取消注释以下(见下图) PHP.ini 设置
  • Copy 3 files from C:\\oracle\\instaclient12.2.0.1 oci.dll,oraociei12.dll and oraons.dll to xampp apache\\bin .C:\\oracle\\instaclient12.2.0.1 oci.dll、oraociei12.dll 和 oraons.dll 中的 3 个文件复制到 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 .现在在 xampp 上重新启动 Apache 并在浏览器上检查 info.php。 OCI8 module will appear there enable . OCI8 模块会出现在那里 enable 。

Enjoy !!!.享受 !!!。

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.我能够使用 XAMPP 默认附带的 php 更正它。 I'm using windows 10 64 bits as well, but used xampp-win32-7.3.2-0-VC15 (php 7.3.2).我也在使用 windows 10 64 位,但使用了 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 os).总而言之,通过使用 32 位版本(操作系统除外)执行所有操作,我能够获得正确的配置。 The full story and how I've done it:完整的故事以及我是如何做到的:

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 .如果你通过 cmd 进入你的 xampp/php 目录,在我的例子中它是“C:\\xampp\\php”,并通过简单的命令“php”启动 php,它可能会显示在 etc 中找不到什么 dll文件夹或其中哪些与 Win 32 不兼容 If you get this problem, you will not be able to see the OCI8 page when opening a phpinfo() page:如果遇到这个问题,打开phpinfo()页面时将看不到OCI8页面:

在此处输入图片说明

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.如果是这种情况,win 32 兼容性问题或找不到您确定存在的 dll,您应该卸载 XAMPP 并使用 x32 版本重新安装它。 The phpinfo page will show x86 Architecture. phpinfo 页面将显示 x86 架构。 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.请记住在路径变量中删除任何未找到正在使用的 php 的源,这里的重点是使用 XAMPP 中默认提供的源。 If you need by any reason to use another php installation, remember to use x86 architecture.如果您出于任何原因需要使用其他 php 安装,请记住使用 x86 架构。 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.如果您需要更新的 OCI8 dll,您可以在https://pecl.php.net/package/oci8上下载它,但请记住检查线程安全兼容性,您也可以在您的 phpinfo 页面上找到它。 In my case it was enough to use the one provided by XAMPP.在我的情况下,使用 XAMPP 提供的就足够了。

After this, you have to enable the extension:在此之后,您必须启用扩展:

 extension=oci8_12c

in the php.ini configuration file.在 php.ini 配置文件中。 It was enough for me to enable only this one, although some people suggests to also enable extension=pdo_oci.我只启用这个就足够了,尽管有些人建议也启用 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:检查您是否设置了有关扩展的正确路径也很好,在我的情况下:

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

After this, you have to download the Oracle Instant Client.在此之后,您必须下载 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.由于您使用的是 x86 架构(您必须使用这个架构),您需要找到一个 32 位版本的 OIC,但检查哪一个与您取消注释的扩展兼容也很重要。 In my case, of oci8_12c, it was instantclient-basic-nt-12.2.就我而言,oci8_12c 是 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.最后一步是将其解压缩到一个文件夹中,例如“C:\\instantclient_12_2”并将其添加到系统的路径变量中。 Reload apache and check if the OCI8 is shown correcly.重新加载 apache 并检查 OCI8 是否正确显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM