2

I installed oracle 11g and I did create some tables and manipulate it using sql developer, and I am looking for a way to connect oracle with php on hosting site.

I tried but I get error after using this code:

$Conexion_ID =oci_connect($OracleUser, $OraclePassw, $OracleIP);

this is the error:

Call to undefined function oci_connect() 

I've known that I should install and configure OCI8, so I downloaded this file:

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

but I don't know in which folder should I them to make the connection work well.

aynber
  • 22,380
  • 8
  • 50
  • 63
user3891365
  • 71
  • 1
  • 4
  • 13
  • I can give you precise answer if you can specify the architecture and the OS. – Jigar Aug 27 '14 at 06:19
  • I am using windows 7 and local server wamp, I read in the link that I should edit php.ini by adding this line(extension=oci8.so) but what else should I do – user3891365 Aug 27 '14 at 06:22
  • check my answer. I am sure it should work :) if not do update me on this. :) – Jigar Aug 27 '14 at 09:24

2 Answers2

3

Download the PHP Extension from here(Confirm the PHP Version and download for the same, the thread safe[TS] version): http://pecl.php.net/package/oci8/2.0.8/windows

You should be able to find three .dll's

php_oci8.dll, php_oci8_11g.dll and php_oci8_12c.dll

Place all dll's in extension directory, in WAMP it is generally wamp\bin\php\php5.*.*\ext

open the php configuration from the System try of wamp server and add the line:

; Enable only which is required
;extension=php_oci8.dll
extension=php_oci8_11g.dll 
;extension=php_oci8_12c.dll

Restart the Apache server.

EDIT : Sorry I thought the other dll's are the libraries, but instead they are for different oracle versions. In your case enable 11g. Answer updated.

Update 2016-11-07: just wanted to say that latest package can be found here https://pecl.php.net/package/oci8. When I wrote this answer 2.0.8 was latest i guess.

Jigar
  • 3,256
  • 1
  • 30
  • 51
1

if you are using wamp server on windows than you have to use the php_oci8.dll not the oci8.so. You need to download php_oci8.dll and copy it to ext directory under the PHP. If you don't have this extension in your PHP than install it and go to php.ini and add extension=php_oci8.dll.

Please make sure that wamp server have two php.ini files you have to change it on both the places. once everything is done than check with php info that oci 8 installed or not.

Ram Sharma
  • 8,676
  • 7
  • 43
  • 56