Tutorial :php with oracle 9i



Question:

I am new in php with oracle. Trying to connect with oracle by php. But have no success. I have installed xammp since i had to work with mysql. And now i have to use oracle 9i (9.2.0.6). Now if i use --> oci_connect(username, password, servicename) -- It says undefined function oci_connect();

Can any one tell how to configure xammpp for oracle?

Thanks in advance


Solution:1

XAMPP ships with a file ext/php_oci8.dll which contains the extension module. You have to enable that module (i.e. make php load the extension either at runtime or preferably at startup time).

First take a look at http://docs.php.net/oci8.requirements and check the requirements.
Then call

<?php echo 'ini: ', get_cfg_var('cfg_file_path');  

It will tell you which php.ini you have to modify (depending on the version of xampp you're using there may be one ini for the apache module and a different ini for the cli version, or there may be only one file for both the module and the cli version).
In that ini file look for a line like*

;extension=php_oci8  

Remove the semicolon (which made the line a comment) and restart the apache. Done (hopefully).

You might also be interested in the extensions

extension=php_pdo_oci  extension=php_pdo_oci8  

which allow you to use PDO instead of the oci_connect(), oci_execute(), oci_* functions.


* In the build from php.net there are two slightly different extensions modules

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client  ;extension=php_oci8_11g.dll  ; Use with Oracle 11g Instant Client  

XAMPP seems to ship with only one php_oci8.dll.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »