简体   繁体   English

在同一服务器上使用带有64位oracle客户端的php 7.3.4 64bit和带有32位oracle客户端的php 7.3.4 32bit

[英]Using php 7.3.4 64bit with a 64bit oracle client and php 7.3.4 32bit with a 32bit oracle client on the same server

We have an IIS on our Windows Server 2016 Standard which use via fast cgi a php 7.3.4 32bit. 我们在Windows Server 2016 Standard上有一个IIS,它通过快速cgi使用php 7.3.4 32bit。
To build a connection to a oracle 12cR1 database on another server we use the php_oci8_12c.dll and the oracle client 12.1.0 32bit. 要在另一台服务器上建立与oracle 12cR1数据库的连接,我们使用php_oci8_12c.dll和oracle客户端12.1.0 32位。

This works fantastic. 这很棒。 Now we want to switch to php 64bit, but for some old projects we still need the 32bit php and oracle client. 现在我们要切换到64位php,但是对于某些旧项目,我们仍然需要32位php和oracle客户端。

So we do the follow: 因此,我们执行以下操作:
1. Uninstall the oracle client 1.卸载oracle客户端
2. Install oracle client 12.1.0 64 bit (install type: administration) in C:\\Oracle\\product\\12.1.0\\client_x64 2.在C:\\Oracle\\product\\12.1.0\\client_x64安装oracle客户端12.1.0 64位(安装类型:管理)
3. Restart server 3.重新启动服务器
4. Configure the net manager 4.配置网络管理器
5. Install oracle client 12.1.0 32 bit (install type: administration) in C:\\Oracle\\product\\12.1.0\\client_x86 5.在C:\\Oracle\\product\\12.1.0\\client_x86安装oracle客户端12.1.0 32位(安装类型:管理)
4. Restart server 4.重新启动服务器
5. Configure the net manager 5.配置网络管理器
6. Download php 7.3.4 64 bit with the 64 bit extensions 6.下载具有64位扩展名的PHP 7.3.4 64位

Now we have two php folders: 现在我们有两个php文件夹:
C:\\php7_3_4_x86
C:\\php7_3_4_x64

At this time the IIS use the C:\\php7_3_4_x86\\php-cgi.exe and the 32bit oracle client, because its the latest installed client and the path is the first of all paths in the PATH variable. 此时,IIS使用C:\\ php7_3_4_x86 \\ php-cgi.exe和32位oracle客户端,因为其最新安装的客户端和路径是PATH变量中所有路径中的第一个。

Now we want to switch temporary to 64bit. 现在我们想将临时切换到64位。 So we try the follow steps: 因此,我们尝试执行以下步骤:
1. Change in IIS handler to C:\\php7_3_4_x64\\php-cgi.exe 1.将IIS处理程序更改为C:\\ php7_3_4_x64 \\ php-cgi.exe
2. Swap the oracle clients path in the environment variable PATH. 2.在环境变量PATH中交换oracle客户端路径。 Now its: C:\\Oracle\\product\\12.1.0\\client_x64;C:\\Oracle\\product\\12.1.0\\client_x86;[...] 现在它是: C:\\Oracle\\product\\12.1.0\\client_x64;C:\\Oracle\\product\\12.1.0\\client_x86;[...]
3. Restart the server 3.重新启动服务器

After restart we try to open a php file in browser, but we get the follow error: 重新启动后,我们尝试在浏览器中打开一个php文件,但出现以下错误:
Call to undefined function oci_connect

If we put the oci.dll from C:\\Oracle\\product\\12.1.0\\client_x64\\BIN directly into the C:\\php7_3_4_x64 it loads the file. 如果我们将C:\\Oracle\\product\\12.1.0\\client_x64\\BIN的oci.dll直接放入C:\\php7_3_4_x64则会加载文件。 So we think it cannot find the 64bit client. 因此,我们认为它找不到64位客户端。

We also try the method with create a link in C:\\Windows\\system32 / SYSWOW64, but this doesnt work. 我们还尝试在C:\\ Windows \\ system32 / SYSWOW64中创建链接的方法,但这不起作用。 Same error. 同样的错误。

What could we do? 我们该怎么办? We need the possibility to switch between 32&64bit php+oracle. 我们需要在32和64位php + oracle之间切换的可能性。

Problem solved. 问题解决了。

Everything was correctly, but the oracle setup forgot the correct windows right for the clientx64 folder. 一切都正确,但是oracle安装程序忘记了clientx64文件夹的正确窗口。

At the clientx86 the group "authenticated user" (in german: Authentifizierter Benutzer) has full access, while the clientx64 doesnt have this group. clientx86 ,组“已认证用户”(德语:Authentifizierter Benutzer)具有完全访问权限,而clientx64没有该组。

After adding the group and give it full access to the clientx64 folder it works. 添加组并授予其对clientx64文件夹的完全访问权限后,它便可以工作。 It isn't necessary to switch the entries in the PATH variable. 无需切换PATH变量中的条目。 PHP try to loading the first element and after failing it loads the second element in PATH variable. PHP尝试加载第一个元素,失败后将其加载到PATH变量中的第二个元素。

So everything works! 所以一切正常!

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

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