如何在Win7 x64上将oracle客户端11.2与php(xampp)一起使用 [英] How to use oracle client 11.2 with php (xampp) on win7 x64

查看:202
本文介绍了如何在Win7 x64上将oracle客户端11.2与php(xampp)一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在win7(x64)PC上安装了一个原始XAMPP,以编写一些PHP脚本来连接到Oracle数据库.我也安装了一个普通的oracle 11.2.0客户端(正确设置了PATH和ORACLE_HOME).该客户端用于我的所有其他工作,没有任何问题.

I just installed an acutal XAMPP on my win7 (x64) PC to write some PHP scripts to connect to an oracle DB. I also have a normal oracle 11.2.0 client installed (PATH and ORACLE_HOME are set correctly). The client is used for all my other work without any problems.

当我尝试连接到Oracle DB时,PHP失败并显示Fatal error: Call to undefined function oci_connect() in.我记得几年前当我在x32 winXP PC上执行相同的操作时,必须在php.ini中启用"oci8-extensions". 但是我当前的xampp在php/ext文件夹中没有这些dll(只有一个php_oci8_12c.dll,它会在apache start上引发一些未知功能的错误,并且是针对oracle 12而不是11)的,而php.ini也表示它们是仅即时客户端需要.

When I try to connect to an oracle DB PHP fails with Fatal error: Call to undefined function oci_connect() in. I remember I had to enable the "oci8-extensions" in my php.ini when I did the same thing some years ago on a x32 winXP PC. But my current xampp does not have these dll in the php/ext folder (only a php_oci8_12c.dll which throws several errors of unknown functions on apache start and which is for oracle 12 and not 11) and the php.ini also says they are only needed for the instant client.

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

SO-问题还显示,使用带有普通客户端将无法正常工作(我也尝试过).

Also this SO-questions shows that using the comment extension with a normal client will not work (which I also tried).

我尝试用Google搜索解决方案,但所有解决方案"都是安装win32 Instant Client并启用扩展程序".但我无法执行此操作,因为我的大多数质量检查工作都需要安装并配置11.2.0-client,而且我的php/ext-folder中始终没有.dll

I tried to google for a solution but all "solutions" are "install win32 instant client and enable extension". But I can`t do this as most of my QA-work requires the installed and configured 11.2.0-client and I don't have the .dll in my php/ext-folder anyway

我还尝试将ociw32.dll从client/bin文件夹复制到php/ext-folder,但是apache说它不是PHP库.

I also tried to copy the ociw32.dll from the client/bin folder to the php/ext-folder but then apache says it's not an PHP-library.

那么我如何才能使PHP oracle库在x64 win7上的XAMPP上使用oci8 没有安装win32 Oracle Instant Client并销毁我的当前设置?

So how can I enable PHP oracle libraries to use oci8 for XAMPP on x64 win7 WITHOUT installing win32 Oracle Instant Client and destroying my current setting?

我还尝试了《 PHP:安装手册》( :gmail dot com上的samantha dot vincent),包括更改我的apache-http.conf也无济于事.

edit: I also tried the steps described in the PHP: Installation Manual (Post of: samantha dot vincent at gmail dot com) including changing my apache-http.conf which also didn't help.

我也很困惑我的phpinfo()-输出

Configure Command   "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared"

推荐答案

我终于找到了解决方案:

I finally found a solution:

我从"PECL :: PAckage :: oci8 :: 2.0.8"(在我的情况下是32位的线程安全DLL),然后从该行中删除;

I downloaded the actual OCI-DLLs from "PECL :: PAckage :: oci8 :: 2.0.8" (in my case the 32bit, threadsafe DLL) and then removed the ; from this line

;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

我还在我的apache的http.conf中添加了以下几行

I also added the following lines to my http.conf of apache

SetEnv ORACLE_BASE "C:/oracle/"
SetEnv ORACLE_HOME "C:/oracle/product/11.2.0/client_1"  

之后,我重新启动了apache,请确保将连接别名放在我的tsnames.ora中,然后可以使用oci8-functions来解决任何问题.

After that I restarted apache, made sure that my connection-alias is probably placed in my tsnames.ora and then I could use the oci8-functions witout any problems.

这篇关于如何在Win7 x64上将oracle客户端11.2与php(xampp)一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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