如何在win7 x64上使用带有php(xampp)的oracle客户端11.2

我刚刚在我的win7(x64)PC上安装了一个实际的XAMPP来编写一些PHP脚本来连接oracle DB 。 我也安装了一个普通的oracle 11.2.0客户端(正确设置了PATH和ORACLE_HOME)。 客户端用于我的所有其他工作没有任何问题。</ p>

当我尝试连接到oracle数据库时,PHP失败并出现致命错误:调用未定义的函数oci_connect()in </代码>。 我记得几年前我在x32 winXP PC上做了同样的事情时,我必须在我的php.ini中启用“oci8-extensions”。
但是我现在的xampp在 php / ext中没有这些dll </ code>文件夹(只有 php_oci8_12c.dll </ code>,它会在apache启动时抛出几个未知函数的错误,而且是针对oracle 12而不是11),而php.ini也说它们只需要 即时客户端。</ p>

 ; extension = php_oci8.dll; 与Oracle 10gR2 Instant Client一起使用
; extension = php_oci8_11g.dll; 与Oracle 11gR2 Instant Client一起使用 </ pre>

SO-questions 显示使用普通客户端的评论扩展名不起作用(我也尝试过)。</ p>

我试图谷歌寻求解决方案 但所有“解决方案”都是“安装win32即时客户端并启用扩展”。 但我不能这样做,因为我的大多数QA工作都需要安装和配置的11.2.0客户端,而且我的php / ext文件夹中没有.dll </ p>

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

那么我怎么能 允许PHP oracle库在x64 win7上使用oci8 for XAMPP 没有</ strong>安装win32 Oracle Instant Client并破坏我当前的设置?</ p>

编辑:我也尝试了所描述的步骤 在PHP:安装手册中(帖子:samantha dot vincent at gmail dot com)</ a>包括更改我的apache-http.conf也没有帮助。</ p>

我也对我的 phpinfo()</ code> -Output感到困惑,因为它说 </ p>

 配置命令“--with-pdo-oci = c:\ php-sdk \ oracle \ x86 \ instantclient_12_1 \ sdk,shared”“--with-oci8-12c  = C:\ PHP-SDK \ ORACLE \ 86 \ instantclient_12_1 \ SDK,沙 红色“
</ code> </ pre>
</ div>

展开原文

原文

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.

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

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

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

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.

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?

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.

I'm also confused of my phpinfo()-Output as it says

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"

1个回答



我终于找到了一个解决方案:</ p>

我从”PECL :: PAckage :: oci8 :: 2.0.8“(在我的情况下) 32bit,threadsafe DLL)然后从这行中删除; </ code> </ p>

 ; extension = php_oci8_11g.dll; 与Oracle 11gR2 Instant Client一起使用
</ code> </ pre>

我还在apache的http.conf中添加了以下行:</ p>

   SetEnv ORACLE_BASE“C:/ oracle /”
SetEnv ORACLE_HOME“C:/oracle/product/11.2.0/client_1”
</ code> </ pre>

之后我重新启动了apache, 确保我的连接别名可能放在我的 tsnames.ora </ code>中,然后我就可以使用oci8函数来解决任何问题。</ p>
</ div>

展开原文

原文

I finally found a solution:

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

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"  

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.

duanhu7400
duanhu7400 它之前没有工作,那我做了什么? 我只是将文件orannzsbb11.dll,oci.dll和oraociei11.dll复制到c:\ windows \ system32。 并重新启动apache,最后它正在工作..... :)
4 年多之前 回复
drtppp75155
drtppp75155 我使用普通的Oracle客户端而不是问题中所说的即时客户端
接近 5 年之前 回复
duankui3838
duankui3838 嗨,我想知道'SetEnv ORACLE_BASE'C:/ oracle /“'做什么? 这是Oracle客户端而不是Instant客户端吗?
接近 5 年之前 回复
duanhe1976
duanhe1976 与你的下载无需更改http.conf,本教程:XAMMP | ORACLE | 和PHP.NET
大约 5 年之前 回复
dourang8305
dourang8305 在你的php / bin目录中。
5 年多之前 回复
duanmu2013
duanmu2013 请告诉我你把你下载的文件放在哪里?
5 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐