Ask Experts Questions for FREE Help !
Ask
    asela_05085's Avatar
    asela_05085 Posts: 3, Reputation: 1
    New Member
     
    #1

    Sep 3, 2009, 05:51 AM
    Connect with remote oracle database from PHP
    Hi,

    I need to connect to a remote oracle database from a PHP script.
    Do I need to install any drivers or packages to connect with the remote database?

    When I use below code

    <?php
    if ($c = oci_connect("username", "passwd", "remote server IP")) {
    echo "Successfully connected to Oracle.";
    oci_close($c);
    } else {
    $err = oci_error();
    echo "Oracle Connect Error " . $err['text'];
    }
    ?>


    It gives below error
    "PHP Fatal error: Call to undefined function: oci_connect() "

    I'm wondering whether I need to install any drivers

    Advice someone

    Thanks
    Edit/Delete Message
    retsoksirhc's Avatar
    retsoksirhc Posts: 912, Reputation: 71
    Senior Member
     
    #2

    Sep 3, 2009, 06:22 AM

    What type of server are you using? You need to enable support for oracle in php, either by compiling it with support or installing relevant packages on linux, or uncommenting the line to include the extension dll in windows.
    retsoksirhc's Avatar
    retsoksirhc Posts: 912, Reputation: 71
    Senior Member
     
    #3

    Sep 3, 2009, 06:24 AM
    This link may help, too
    PHP: OCI8 - Manual

    I'm not really familiar with Oracle, but I do know my way around PHP pretty well.
    asela_05085's Avatar
    asela_05085 Posts: 3, Reputation: 1
    New Member
     
    #4

    Sep 3, 2009, 06:30 AM
    I'm running my WEB Service on redhat linux machine with PHP 4.3 and I need to connect with a remote oracle db.
    Can you let me know what are those packages.
    I have searhed but couldn't found anything

    Thanks
    retsoksirhc's Avatar
    retsoksirhc Posts: 912, Reputation: 71
    Senior Member
     
    #5

    Sep 3, 2009, 07:09 AM

    I'd start with this to install the oracle libraries on your linux box. It'd probably be easiest to just download and run the RPM
    Instant Client downloads for Linux x86

    Then I would find your PHP ./configure (where you had installed PHP from) and run it again, with --with-oci8, along with all your other options. One of the examples here: PHP: Installation - Manual says to do this

    /configure --with-oci8=instantclient,/usr/lib/oracle/10.2.0.2/client

    There should be one option on that pages that works for you.
    asela_05085's Avatar
    asela_05085 Posts: 3, Reputation: 1
    New Member
     
    #6

    Sep 3, 2009, 08:13 PM

    Thanks retsoksirhc.
    I'll try that

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Creation day of oracle database [ 1 Answers ]

How to find out when Oracle database was created by writing a sql? Thank you Sam

Self-referenced table in Oracle 9i database for huge amounts of data [ 5 Answers ]

Hello! I'm designing a database (Oracle 9i) for payments registration system, obviously it will hold a VERY big amount of data, which is going to be changing constantly. There are so called “list payments”, which have several beneficiaries bound to it, additionally for transferring money to some...

How do I connect to a database [ 2 Answers ]

Hi, I'm having problems connecting to my database. I have had my site working perfectly on brinkster, but when I've moved it over to my new host it doesn't work. How do I know what way I should be connecting to the database i.e. DNS-less, system DNS or file DNS etc. Could some one...


View more questions Search