Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 66

Thread: Howto: Install Oracle Instant Client and PHP OCI8 module

  1. #11
    Join Date
    Apr 2005
    Location
    Illinois
    Beans
    272

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Quote Originally Posted by Alf Stockton View Post
    As mentioned at http://forums.oracle.com/forums/thre...04923&tstart=0
    you set environment variables for Oracle 10g XE in Linux by :-
    source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

    this could also be done as
    . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh

    but don't make the same mistake that I did by leaving out the dot space at the beginning of the above line.

    My question is, does this overall solution work for getting OCI8 to access local Oracle databases? I thought instantclient was only for remote DataBases.
    Thanks. I'll try that tonight. Once I set the environment variables, will OCILogon("user","pwd","XE") work?

    Thanks for the help.
    ===============================
    My Blog: http://www.blog.arun-prabha.com/
    My Home: http://www.arun-prabha.com
    ===============================

  2. #12
    Join Date
    Apr 2005
    Location
    Illinois
    Beans
    272

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    I ran the . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
    command in a terminal and it went fine (no errors). I then ran this small PHP script named hello.php:
    <?php
    $db=OCILogon("username", "pwd","XE");

    ?>
    I got the following error when I tried http://localhost/hello.php in a browser:
    Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/hello.php on line 2.
    Any idea?
    ===============================
    My Blog: http://www.blog.arun-prabha.com/
    My Home: http://www.arun-prabha.com
    ===============================

  3. #13
    Join Date
    Aug 2006
    Beans
    1

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Thanks, I just installed OCI on my Ubuntu Dapper. Now to see if it works... at least it appears when I do a phpinfo() !!!

    Just one thing: on the instructions at the beginning of this topic it says you have to unzip two zip files. It should also be noted that the contents of both zip files should be directly under /opt/oracle/instantclient... I lost some minutes wondering why it didn't work and the reason was that the "unzip" command creates folders called something like "instantclient-sdk-linux32-10.2.0.2-20060331.zip_FILES"...

  4. #14
    Join Date
    Oct 2005
    Beans
    3

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Quote Originally Posted by masonite View Post
    An excellent howto! Thanks - you've really saved me!

    I tried with the basiclite version that oracle makes available and it didn't work very well (at all) - the issue was that it's missing the libociei.so library.

    Be sure to use the full basic client. Currently instantclient-basic-linux32-10.2.0.2-20060331.zip

    I also had to set the environ a little as well:
    export LD_LIBRARY_PATH=/opt/oracle/instantclient/

    Good luck!
    i had to set up the LD_LIBRARY_PATH with a :

    SetEnv LD_LIBRARY_PATH /opt/oracle/instantclient

    in apache.

    export LD_LIBRARY_PATH=/opt/oracle/instantclient/ may still work but then you gotta be more precise for what user you do this.

    more about this at http://www.phpfreaks.com/forums/inde...5498.msg382340

  5. #15

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    I tried doing that, but Apache is disconnecting and throwing a segmentation fault. How can I fix that?

  6. #16
    Join Date
    Aug 2006
    Beans
    12

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Thank you! The best Howto I've user used!

    I used the pecl oci install

    A couple of things in case anyone else comes up against them;

    When I unzipped instant client the root directory was /opt/oracle/instantclient/instantclient_10_2 so I had to use this as the root folder I gave to the pecl install

    pecl gave me an error saying that the oci8 install was hitting its memory limit, to get round this edit the command line at the bottom of /usr/bin/pecl to include the statement -d memory_limit=20M

    Worked fine for me after that.

  7. #17
    Join Date
    Mar 2007
    Beans
    10

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Hell all,
    I really enjoy distribution ubuntu 6.10 for it's simplicity so I want to share my few commands howto for setting up apache for connection to remote oracle database:
    root@roleta:/home/rollyboy# uname -a
    Linux roleta 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux
    root@roleta:/home/rollyboy#

    apt-get install oracle-xe-client #ofcourse you need to set up your /etc/apt/sources.list
    it will install oracle client to /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/ (oracle home directory)

    apt-get install php-pear
    apt-get install build-essential
    In next step you will be asked for oracle home directory, put there the path mentioned above
    pecl install oci8
    echo "extension=oci8.so" >> /etc/php5/cli/php.ini
    echo "extension=oci8.so" >> /etc/php5/apache2/php.ini
    /etc/init.d/apache2 restart


    #######simple pease of php code for connection to remote databse
    if(!($conn = oci_connect(USERNAME,PASS,SERVER_NAME.":".PORT_NUM BER."/".SEVICE_NAME)))
    {
    DisplayErrMsg(sprintf("error connecting to host %s, by user %s",
    SERVER_NAME, USERNAME)) ;
    exit() ;
    }

  8. #18
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Thank you so much!

    A little add-on:

    The last parameter is the SID

    Code:
    oci_connect("user", "password", "10.0.0.x:1521/sid")
    Difference between service_name and database_name?
    Last edited by docker; August 22nd, 2007 at 02:16 PM. Reason: complement

  9. #19
    Join Date
    Feb 2006
    Beans
    Hidden!
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Greetings everybody.

    First of all let me congratulate you all for the maintenance of this extraordinary forum. You can see that by my low number of posts... I rarely need to ask something.

    Now for the big question...
    When I try to do "pecl install oci8", I get a "Oracle Instant Client SDK header files not found" error.

    Could you please provide some info regarding this item?

    Best regards,
    CFK

  10. #20
    Join Date
    Feb 2006
    Beans
    Hidden!
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: Howto: Install Oracle Instant Client and PHP OCI8 module

    Problem solved!

    There was a directory mismatch somewhere, making impossible to the script to find InstantClient libraries and Oracle SDK.

    My final directory arrangement ended up like this:

    /opt/oracle/instantclient/instantclient (before /opt/oracle/instantclient/instantclient_11_1)
    /opt/oracle/instantclient/sdk (before /opt/oracle/instantclient/instantclient_11_1/sdk)

    After this, I ran the command pecl install oci8 and gave the following information:

    instantclient,/opt/oracle/instantclient/instantclient

    Then everything was working fine in PHP right after adding the extra line to load the OCI8 extension.

    Best Regards,
    CFK

Page 2 of 7 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •