简体   繁体   English

PHP,IIS,Oracle(OCI)无法正常工作

[英]PHP, IIS, Oracle (OCI) not working

We are migrating from a Windows SBS 2011 to Windows Server 2012 R2. 我们正在从Windows SBS 2011迁移到Windows Server 2012 R2。

We have an internal website that connects to our Oracle database using PHP. 我们有一个内部网站,可以使用PHP连接到我们的Oracle数据库。

I am trying to migrate this to the new server and so far I have: 我正在尝试将其迁移到新服务器,到目前为止,我已经:

  1. Installed IIS Server Role 安装的IIS服务器角色
  2. Installed PHP 已安装PHP
  3. Downloaded Oracle Instant Client to C:\\instantclient 将Oracle Instant Client下载到C:\\ instantclient
  4. Added C:\\instantclient to PATH System Variable 将C:\\ instantclient添加到PATH系统变量
  5. Added php_oci8.dll to php.ini and checked that PHP is actually using this php.ini 将php_oci8.dll添加到php.ini中,并检查PHP是否实际上正在使用此php.ini
  6. Restarted server 重新启动服务器

I am still getting error messages like oci_ commands not being recognised etc. 我仍然收到诸如oci_命令无法识别等错误消息。

I'm lost. 我迷路了。 I've searched online and the instructions match what I have done from memory. 我已经在网上进行搜索,说明中的内容与我从内存中所做的内容相符。

I haven't found a single thing online that I haven't done. 我没有在网上找到一件我还没有做过的事情。

Depending on the version of InstantClient you have installed you might need to include the bin folder in the path, like so: 根据您安装的InstantClient的版本,您可能需要在路径中包含bin文件夹,如下所示:

C:\instantclient\bin

To check if the DLL files are available in the path enter where oci*.dll in a command prompt. 要检查DLL文件在路径中是否可用,请在命令提示符下输入where oci*.dll It should return a list of matching files. 它应该返回匹配文件的列表。

Also, remember that just because your account can see the DLL files doesn't mean IIS/PHP can. 另外,请记住,仅仅因为您的帐户可以看到DLL文件,并不意味着IIS / PHP可以。 That runs under a different account that might not have permission to access the files. 它在可能没有权限访问文件的其他帐户下运行。 Check your IIS error log and PHP php_errors.log file for any specific error messages. 检查您的IIS错误日志和PHP php_errors.log文件,以获取任何特定的错误消息。


Edit 编辑

After a rather lengthy chat , the problem was resolved by: 经过相当长时间的聊天 ,该问题已通过以下方法解决:

  • Updating the InstantClient from 10.1.0.5 to 10.2.0.5 (as mentioned in the module requirements : On Windows, the php_oci8 DLL needs Oracle client libraries from version 10gR2 or greater. ) 将InstantClient从10.1.0.5更新到10.2.0.5(如模块要求中所述在Windows上,php_oci8 DLL需要版本10gR2或更高版本的Oracle客户端库。
  • Adding a copy of msvcr71.dll to the InstantClient folder. msvcr71.dll的副本添加到InstantClient文件夹中。
  • Downloading and manually configuring PHP from php.net instead of using PHP Manager for IIS . php.net下载并手动配置PHP,而不是使用IIS的PHP Manager
  • Ensuring the Path environment variable correctly pointed to the InstantClient and PHP folders. 确保Path环境变量正确指向InstantClient和PHP文件夹。

try this: 尝试这个:

extension=php_oci8_12c.dll (instead of php_oci8.dll) - that is what I am using and you probably downloaded the same instant client as I did. extension = php_oci8_12c.dll(而不是php_oci8.dll)-这就是我正在使用的,您可能下载了与我相同的即时客户端。

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

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