调用未定义的函数ocilogon()-IIS 7.5-Windows 2008 R2 x64-PHP 7.2.7 [英] Call to undefined function ocilogon() - IIS 7.5 - Windows 2008 R2 x64 - PHP 7.2.7

查看:87
本文介绍了调用未定义的函数ocilogon()-IIS 7.5-Windows 2008 R2 x64-PHP 7.2.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将网站从开发环境(Angular 4-WAMP Server-PHP 5.6.35)迁移到生产环境.在开发中,Angular 4应用程序成功地能够连接到PHP脚本并运行Oracle存储过程,因此代码没有问题.

I am migrating a website from a development environment (Angular 4 - WAMP Server - PHP 5.6.35) to a production environment. In development, the Angular 4 application was successfully able to connect to a PHP script and run an Oracle stored procedure so there are no issues with the code.

在生产中,我必须使用Web平台安装程序来安装PHP,才能成功使用显示"PHP版本7.2.7"的phpinfo()运行PHP站点.我运行该应用程序,当它尝试运行PHP脚本时,在运行该脚本时出现500 Internal Server错误.PHP错误日志显示:

In production, I've had to install PHP using the Web Platform Installer to successfully run a PHP site with phpinfo() showing 'PHP Version 7.2.7'. I run the application and when it attempts to run the PHP script, I get a 500 Internal Server error when the script is run. PHP error logs show:

<b>Fatal error</b>:  Call to undefined function ocilogon() in <b>C:\inetpub\wwwroot\app\assets\scripts\php\pullData.php</b> on line <b>154</b><br />

研究表明该问题可能是:

Research has indicated that the issue could be:

  1. 可能的IIS配置问题
  2. Oracle Instant Client问题
  3. 未启用OCI8 PHP库

我认为我已经排除了IIS配置,因为前端连接到PHP并运行脚本没有问题.

I think I've ruled out the IIS configuration as the front-end connects to PHP and runs the scripts without issue.

已安装Oracle Instant Client 12.1,其他应用程序可以连接到Oracle.PATH环境变量显示正确设置.我不知道它是32位还是64位版本-或是否有区别.

Oracle Instant Client 12.1 is installed and other applications can connect to Oracle. The PATH environment variable appears correctly set. I don't know if it is a 32-bit or 64-bit version - or whether this makes a difference.

我认为这是问题所在-OCI8库未正确启用.在开发服务器上,我能够修改php.ini文件以取消注释(并启用)dll,并且phpinfo()在列表中显示了OCI8库:

I think this is the issue - the OCI8 library isn't enabled correctly. On the dev server, I was able to modify the php.ini file to uncomment (and enable) the dll, and phpinfo() showed the OCI8 library in the list:

extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

在生产中,我不得不手动添加'extension = php_oci8_12c.dll'行(并不是没有注释掉),并且我检查了PHP的EXT文件夹,并且该dll存在于此.Phpinfo()仍未显示已启用OCI8库.

On production, I've had to manually add the 'extension=php_oci8_12c.dll' line (it wasn't uncommented out) and I've checked the EXT folder of PHP and the dll exists there. Phpinfo() still doesn't show the OCI8 library enabled.

推荐答案

问题已修复,我已按照以下步骤进行了修复:

Issue is fixed, and I took the following steps to fix it:

  1. 未安装PHP(已删除所有PATH引用和文件夹).
  2. 使用Oracle Universal Installer卸载Oracle Instant Client.
  3. 使用IIS Web平台安装程序为IIS Express(和所有依赖项)安装了PHP.
  4. 使用自动安装程序(winx64_12102_client.zip)而非ZIP文件安装了Oracle Instant Client 12c.这样,我不必手动添加PATH变量等.
  5. 使用phpinfo()检查了PHP版本(如果它是线程安全的).线程安全被禁用.从Windows.php.net下载了php_oci8_12c.dll的非线程安全(nts)版本( https://windows.php.net/downloads/pecl/releases/oci8/2.1.8/),然后将内容复制到PHP安装目录中的EXT文件夹中(位于IIS Express的父文件夹).
  6. 编辑了PHP.ini文件(php.ini-production和php.ini-development和php.ini),以包含"extension = php_oci8_12c.dll"或不加注释的"extension = oci8_12c".
  7. 重新启动服务器(可能不必要).
  8. 打开CMD并运行代码'php --ri oci8'以检查OCI8支持是否已启用,并使用我刚安装的Oracle Instant Client版本.也使用phpinfo()验证了这一点.
  9. 完成.OCI功能现在可以使用.
  1. Uninstalled PHP (removed all PATH references and folders).
  2. Uninstalled Oracle Instant Client using Oracle Universal Installer.
  3. Installed PHP for IIS Express (and all dependencies) using the IIS Web Platform Installer.
  4. Installed Oracle Instant Client 12c using automatic installer (winx64_12102_client.zip), not ZIP file. This way I didn't have to manually add PATH variables etc.
  5. Checked PHP version (and if it was thread safe) using phpinfo(). Thread safety was (is) disabled. Downloaded the non-thread-safe (nts) version of php_oci8_12c.dll from windows.php.net (https://windows.php.net/downloads/pecl/releases/oci8/2.1.8/) and copied contents to EXT folder in the PHP install directory (which was in a parent folder of IIS Express).
  6. Edited the PHP.ini files (php.ini-production and php.ini-development and php.ini) to include 'extension=php_oci8_12c.dll' or uncomment "extension=oci8_12c".
  7. Restarted the server (probably unnecessary).
  8. Opened CMD and ran the code 'php --ri oci8' to check OCI8 support is enabled and using the version of Oracle Instant Client that I just installed. Verified this also by using phpinfo().
  9. Done. OCI functions now work.

这是一个艰苦的过程,因为此Web服务器安装了多个Oracle Instant Client,并且在安装PHP 5.6及其依赖项时,用于IIS的Web平台安装程序存在问题.我很幸运,这次安装程序没有像最初安装PHP 5.6时那样错误地出现PHP 7.2.

This was a grueling process because this web server had multiple installs of Oracle Instant Client and the Web Platform Installer for IIS was buggy when installing PHP 5.6 and its dependencies. I was lucky that this time that the installer did not error out with PHP 7.2 as it originally did when installing PHP 5.6.

这篇关于调用未定义的函数ocilogon()-IIS 7.5-Windows 2008 R2 x64-PHP 7.2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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