PHP, IIS, Oracle (OCI) not working

可紊 提交于 2019-12-19 11:54:48

问题


We are migrating from a Windows SBS 2011 to Windows Server 2012 R2.

We have an internal website that connects to our Oracle database using PHP.

I am trying to migrate this to the new server and so far I have:

  1. Installed IIS Server Role
  2. Installed PHP
  3. Downloaded Oracle Instant Client to C:\instantclient
  4. Added C:\instantclient to PATH System Variable
  5. Added php_oci8.dll to php.ini and checked that PHP is actually using this php.ini
  6. Restarted server

I am still getting error messages like oci_ commands not being recognised etc.

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.


回答1:


Depending on the version of InstantClient you have installed you might need to include the bin folder in the path, like so:

C:\instantclient\bin

To check if the DLL files are available in the path enter where oci*.dll in a command prompt. 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. 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.


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.)
  • Adding a copy of msvcr71.dll to the InstantClient folder.
  • Downloading and manually configuring PHP from php.net instead of using PHP Manager for IIS.
  • Ensuring the Path environment variable correctly pointed to the InstantClient and PHP folders.



回答2:


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.



来源:https://stackoverflow.com/questions/27295293/php-iis-oracle-oci-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!