DBAsupport.com Forums - Powered by vBulletin
Results 1 to 1 of 1
  1. #1
    Join Date
    Oct 2004

    Installing Oracle 10g R2 , Apache (2.0.54), and PHP (5.0.4) on CentOS 4.1 (RHEL 4 U1)

    Download from:-


    Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI Applications


    Instant Client Package - SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client


    Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client


    Install PHP, Apache and Oracle Instant Client
    Installing and testing Instant Client

    Run as root:-

    # rpm –Uvh oracle-instantclient-basic-
    # rpm –Uvh oracle-instantclient-sqlplus-
    # rpm –Uvh oracle-instantclient-devel-

    # useradd -g oinstall –G dba orauser
    # passwd orauser

    Login as orauser.Test connection to the database:

    $ export LD_LIBRARY_PATH=/usr/lib/oracle/
    $ /usr/lib/oracle/ scott/passwd@//hostname/orclraw
    SQL> exit

    Installing and testing Apache
    Login as your "orauser" user
    Build Apache:

    $ bzcat httpd-2.0.54.tar.bz2 | tar xf -
    $ cd httpd-2.0.54
    $ ./configure --prefix=$HOME/apache --enable-so --with-mpm=prefork
    $ make
    $ make install

    Edit $HOME/apache/conf/httpd.conf and change the port to 8888:

    Listen hostname:8888

    Start Apache:

    $HOME/apache/bin/apachectl start

    Start a browser and check that http://hostname:8888/ gives the
    default Apache web page.

    Stop Apache:

    $HOME/apache/bin/apachectl stop

    Installing and testing PHP
    Build PHP:

    $ bzcat php-5.0.4.tar.bz2 | tar xf -
    $ cd php-5.0.4
    $ ./configure \
    --prefix=$HOME/php \
    --with-apxs2=$HOME/apache/bin/apxs \
    --with-config-file-path=$HOME/apache/conf \
    --with-oci8-instant-client=/usr/lib/oracle/ \

    $ make
    $ make install
    $ cp php.ini-recommended $HOME/apache/conf/php.ini

    Edit php.ini and change display_errors to On:

    display_errors = On

    Add these lines to the $HOME/apache/conf/httpd.conf file:

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    Restart Apache:

    $HOME/apache/bin/apachectl start

    LD_LIBRARY_PATH should contains /usr/lib/oracle/ before
    starting Apache

    Test it all works

    TEST 1:

    Create a file $HOME/apache/htdocs/phpinfo.php containing:


    Load this file in a browser:


    Check the value of LD_LIBRARY_PATH in the Environment section.
    it should contain the Instant Client directory.

    Check that there is a section "oci8" with OCI8 Support marked as

    TEST 2:

    Create a file $HOME/apache/htdocs/test.php containing:

    $conn = OCILogon("scott", "tiger", "//hostname/orclraw");

    if (!$conn) {

    echo OCIServerVersion($conn) ."
    print date('Y-m-d H:i:s')."


    $query = 'SELECT * FROM EMP';

    $stid = OCIParse($conn, $query);
    OCIExecute($stid, OCI_DEFAULT);

    print '';
    while ($succ = OCIFetchInto($stid, $row, OCI_RETURN_NULLS)) {
    print '';
    foreach ($row as $item) {
    print '';
    print '';
    print '
    '.($item?htmlentities($item):' ').'


    Load this file in a browser:

    Last edited by dba477; 11-09-2005 at 11:53 PM.

Posting Permissions

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

Click Here to Expand Forum to Full Width

By using this site, you agree to the Privacy Policy