tags:

views:

141

answers:

1
+1  Q: 

php with oracle 9i

Hi everyone, 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

A: 

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.

VolkerK
I uncomment ;extension=php_oci8.dll. But while i start apache from xammp control panel it says:The procedure entry point OCILobRead2 could not be located in the dynamic link lybraryOCI.dllANDPHP start up: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll'
php_oracle
I have copied the oci.dll file from D:\oracle\ora_92\bin\ to php installation directory. And found that php-oci8.dll is already exist at :\xampp\php\ext\php_oci8.dll.
php_oracle
Please remember that i have installed oracle 9i and i have to work with this version
php_oracle
http://docs.php.net/oci8.requirements says: "On Windows, OCI8 needs client libraries from version 10gR2 or greater". There's also a link to the free (of charge) oracle clients. The 10g/11g clients can connect to a 9g database.
VolkerK