PHP Connection to Oracle

Source: Internet
Author: User
Tags install php

  1. Installing Oracle Client

    oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

    oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

    :http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

    RPM-IVH oracle-install*

    The build directory at this time:/usr/lib/oracle/11.2/client64/lib

    Add content to/etc/ld.so.conf:

    /usr/lib/oracle/11.2/client64/lib

    Execute command: Ldconfig

  2. Installing OCI8

    : Http://pecl.php.net/package/oci8

    /usr/bin/phpize (Generate configure configuration file with Phpize)

    ./configure--with-php-config=/usr/bin/php-config--with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64 /lib

    Make && make install

    Note: Phpize installation: Yum install Php-devel

  3. Connect Oracle


    <?php

    $conn = Oci_connect (' User, ' password ', ' Ip:port/sid ');


    $sql = "SELECT count (*) from Test";

    $sth = Oci_parse ($conn, $sql);

    Oci_execute ($sth, Oci_default);

    while ($r =oci_fetch_row ($sth))

    {

    echo $r [0];

    }


    ?>

  4. Problem handling:

    Oracle 11G Special Issues:

    When you first connect, you are prompted

    Ora-24408:could not generate unique server group name

    Solve:

    More/etc/sysconfig/network

    View HOSTNAME

    Vi/etc/hosts

    127.0.0.1 HOSTNAME

PHP Connection to Oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.