简体   繁体   中英

Cant connect PHP(XAMPP) to Oracle using OCI8

Thanks for all the help in advance. I cannot connect my PHP to ORACLE using OCI8. The specs of softwares that i use are

  • Windows 10 Version: Home 64-bit
  • XAMPP Version: 5.6.24
  • PHP Version - 5.6.24
  • PHP Script framework - ZEnd Framework
  • ORACLE - XE 11g - OracleXE112_Win64.zip
  • Instant client - 11.2 - instantclient-basic-nt-11.2.0.2.0.zip
  • ORACLE_HOME variable = C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server
  • PATH - has this this value ORACLE_HOME\\bin

I am using NAVICAT as my mysql client and able to connect to the database using this. Setting like instant client path and sqlplus had to set in this and all working fine.

Now the real issue is connecting PHP to ORACLE using OCI8. I have used this link to download the correct OCI version for the php version i have. 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

  • 5.6 Non Thread Safe (NTS) x86
  • 5.6 Thread Safe (TS) x86
  • 5.6 Non Thread Safe (NTS) x64
  • 5.6 Thread Safe (TS) x64

Tried installing all the php_oci8_11g.dll files from the above libs in the ext folder of XAMPP one by one. Reset the apache and then tried running the script,but no luck. 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 out.phtml') #7 D:\\xampp\\htdocs\\b2 in D:\\xampp\\htdocs\\b2bapptest\\library\\Zend\\Db\\Adapter\\Pdo\\Abstract.php on line 112

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:

Fatal error: Call to undefined function oci_connect()

I was able to correct it using the php that comes by default with XAMPP. I'm using windows 10 64 bits as well, but used 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).

I've seen many problems regarding OCI8 being solved just by turning everything to 32-bits, I think it worths a try. In this question How to enable oci in xampp 5.6.3? I've answered the complete path I've done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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