如何从php连接到Oracle DB 12c? [英] How to connect from php to Oracle DB 12c?

查看:189
本文介绍了如何从php连接到Oracle DB 12c?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用XAMPP v3.2.2,并且试图从PHP连接到Oracle数据库12c.

I am using XAMPP v3.2.2 and I am trying to connect from PHP to Oracle database 12c.

我已经注释掉了php.ini中的扩展名php_oci8_12c.dll,重新启动了Apache,并安装了32bit的Oracle Instantclient_12_2.

I have already commented out the extension php_oci8_12c.dll in php.ini, restarted Apache, and installed Oracle instantclient_12_2 32bit.

但是,我遇到此错误:

致命错误:未捕获错误:调用未定义函数oci_connect()

Fatal error: Uncaught Error: Call to undefined function oci_connect()

推荐答案

遵循有关XAMPP v3.2.2和Oracle数据库12c配置的说明.

Follow instructions for XAMPP v3.2.2 and Oracle database 12c config.

  1. 下载Instantclient_12_2并解压缩到c:\ instantclient_12_2(确保您的xamp和Instantclient都是相同的x86或64位体系结构)
  2. 在任何oracle目录之前为c:\ instantclient_12_2设置环境路径.重新启动电脑
  3. http://pecl.php.net/package下载oci8 dll /oci8/2.0.6/windows
  4. 从上面的链接中选择5.5线程安全(TS)x64
  5. 解压缩所有文件并将其复制到c:/xampp/php/ext目录
  6. 打开php.ini,删除(;)扩展名= php_oci8.dll,扩展名= php_oci8_12c.dll并保存
  7. 重新启动apache
  8. 查看phpinfo并搜索oci8模块(如果已找到并启用),然后确定.
  9. 使用php oracle连接脚本进行测试.
  1. Download instantclient_12_2 and unzip to c:\instantclient_12_2 (make sure your xamp and instantclient both are same architechture x86 or 64-bit)
  2. setup ENVIRONMENT PATH for c:\instantclient_12_2 before any oracle directory. Restart PC
  3. download oci8 dll from http://pecl.php.net/package/oci8/2.0.6/windows
  4. select 5.5 Thread Safe (TS) x64 from above link
  5. unzip and copy all files to c:/xampp/php/ext directory
  6. open php.ini remove (;) for extension=php_oci8.dll, extension=php_oci8_12c.dll and save it
  7. restart apache
  8. look phpinfo and search for oci8 module if found and enabled then ok.
  9. test with php oracle connection script .

这篇关于如何从php连接到Oracle DB 12c?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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