简体   繁体   English

无法使用OCI8将PHP(XAMPP)连接到Oracle

[英]Cant connect PHP(XAMPP) to Oracle using OCI8

Thanks for all the help in advance. 在此先感谢您的所有帮助。 I cannot connect my PHP to ORACLE using OCI8. 我无法使用OCI8将我的PHP连接到ORACLE。 The specs of softwares that i use are 我使用的软件规格如下

  • Windows 10 Version: Home 64-bit Windows 10版本:Home 64位
  • XAMPP Version: 5.6.24 XAMPP版本:5.6.24
  • PHP Version - 5.6.24 PHP版本 - 5.6.24
  • PHP Script framework - ZEnd Framework PHP脚本框架 - ZEnd框架
  • ORACLE - XE 11g - OracleXE112_Win64.zip ORACLE - XE 11g - OracleXE112_Win64.zip
  • Instant client - 11.2 - instantclient-basic-nt-11.2.0.2.0.zip 即时客户端 - 11.2 - instantclient-basic-nt-11.2.0.2.0.zip
  • ORACLE_HOME variable = C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server ORACLE_HOME变量= C:\\ oraclexe \\ app \\ oracle \\ product \\ 11.2.0 \\ server
  • PATH - has this this value ORACLE_HOME\\bin PATH - 具有此值ORACLE_HOME \\ bin

I am using NAVICAT as my mysql client and able to connect to the database using this. 我使用NAVICAT作为我的mysql客户端,并能够使用它连接到数据库。 Setting like instant client path and sqlplus had to set in this and all working fine. 设置像即时客户端路径和sqlplus必须在此设置并且所有工作正常。

Now the real issue is connecting PHP to ORACLE using OCI8. 现在真正的问题是使用OCI8将PHP连接到ORACLE。 I have used this link to download the correct OCI version for the php version i have. 我已经使用此链接为我拥有的php版本下载正确的OCI版本。 https://pecl.php.net/package/oci8 . https://pecl.php.net/package/oci8 I followed the instruction Use 'pecl install oci8-2.0.12' to install for PHP 5.2 - PHP 5.6 from this link and downloaded all the libs under this and they are 我按照指令使用'pecl install oci8-2.0.12'从这个链接安装PHP 5.2 - PHP 5.6并下载了所有的libs,它们是

  • 5.6 Non Thread Safe (NTS) x86 5.6非线程安全(NTS)x86
  • 5.6 Thread Safe (TS) x86 5.6线程安全(TS)x86
  • 5.6 Non Thread Safe (NTS) x64 5.6非线程安全(NTS)x64
  • 5.6 Thread Safe (TS) x64 5.6线程安全(TS)x64

Tried installing all the php_oci8_11g.dll files from the above libs in the ext folder of XAMPP one by one. 尝试逐一安装XAMPP的ext文件夹中的上述库中的所有php_oci8_11g.dll文件。 Reset the apache and then tried running the script,but no luck. 重置apache然后尝试运行脚本,但没有运气。 this was the error message i get 这是我得到的错误信息

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The oci driver is not currently installed' in D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Db\\Adapter\\Pdo\\Abstract.php:112 Stack trace: #0 D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Db\\Adapter\\Abstract.php(448): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Db\\Adapter\\Pdo\\Abstract.php(238): Zend_Db_Adapter_Abstract->query('select * from a...', Array) #2 D:\\xampp\\htdocs\\b2bapptest\\application\\models\\MiscMapper.php(790): Zend_Db_Adapter_Pdo_Abstract->query('select * from a...') #3 D:\\xampp\\htdocs\\b2bapptest\\application\\layouts\\scripts\\layout.phtml(53): Application_Model_MiscMapper->getActiveAnnouncements() #4 D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\View.php(108): include('D:\\xampp\\htdocs...') #5 D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\View\\Abstract.php(880): Zend_View->_run('D:\\xampp\\htdocs...') #6 D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Layout.php(796): Zend_View_Abstract->render('lay 致命错误:未捕获异常'Zend_Db_Adapter_Exception',消息'当前未安装oci驱动程序'在D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ Db \\ Adapter \\ Pdo \\ Abstract.php:112堆栈跟踪:#0 D :\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ Db \\ Adapter \\ Abstract.php(448):Zend_Db_Adapter_Pdo_Abstract - > _ connect()#1 D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ Db \\ Adapter \\ Pdo \\ Abstract.php(238):Zend_Db_Adapter_Abstract-> query('select * from a ...',Array)#2 D:\\ xampp \\ htdocs \\ b2bapptest \\ application \\ models \\ MiscMapper.php(790):Zend_Db_Adapter_Pdo_Abstract-> query ('select * from a')#3 D:\\ xampp \\ htdocs \\ b2bapptest \\ application \\ layouts \\ scripts \\ layout.phtml(53):Application_Model_MiscMapper-> getActiveAnnouncements()#4 D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ View.php(108):include('D:\\ xampp \\ htdocs ...')#5 D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ View \\ Abstract.php(880) :Zend_View - > _ run('D:\\ xampp \\ htdocs ...')#6 D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ Layout.php(796):Zend_View_Abstract-> render('lay out.phtml') #7 D:\\xampp\\htdocs\\b2 in D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Db\\Adapter\\Pdo\\Abstract.php on line 112 out.phtml')#7 D:\\ xampp \\ htdocs \\ b2位于第112行的D:\\ xampp \\ htdocs \\ b2bapptest \\ library \\ Zend \\ Db \\ Adapter \\ Pdo \\ Abstract.php

What am i missing, could someone plz help, i have been with this for over a week to find a solution :( 我错过了什么,有人可以帮忙,我已经用这个超过一个星期找到一个解决方案:(

I had a problem related to OCI8 and XAMPP for days in a row, the problem was shown as: 我连续几天遇到了与OCI8和XAMPP有关的问题,问题显示为:

Fatal error: Call to undefined function oci_connect() 致命错误:调用未定义的函数oci_connect()

I was able to correct it using the php that comes by default with XAMPP. 我能够使用XAMPP默认使用的PHP来纠正它。 I'm using windows 10 64 bits as well, but used xampp-win32-7.3.2-0-VC15 (php 7.3.2). 我也使用Windows 10 64位,但使用的是xampp-win32-7.3.2-0-VC15(php 7.3.2)。 To summarize, I was able to get a correct configuration by doing everything with 32 bits versions (except the os). 总而言之,通过使用32位版本(除了操作系统)完成所有操作,我能够获得正确的配置。

I've seen many problems regarding OCI8 being solved just by turning everything to 32-bits, I think it worths a try. 我已经看到很多关于OCI8被解决的问题,只需将所有内容都转换为32位,我认为值得一试。 In this question How to enable oci in xampp 5.6.3? 在这个问题中如何在xampp 5.6.3中启用oci? I've answered the complete path I've done 我已经回答了我所做的完整路径

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

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