Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Red Hat This forum is for the discussion of Red Hat Linux.


Search this Thread
Old 08-28-2006, 12:36 PM   #1
Registered: Jun 2006
Posts: 132

Rep: Reputation: 15
how to configure php-5.1.4 with oci8 for Oracle9i

I have a oracle database server and a redhat Enterprise v3 linux webserver with apache 1.3.36 ,php-5.1.4.
now I want to enable oracle database connection in webserver, I know I have to setup php oci8, and I installed instant client package-basic and SDK,
I did recompile the php with ./configure --with-oci8 but it stated:Oracle-OCI8 needed libraies not found.
then I did:./configure --with-oci8=/usr/lib/oracle/ the instant client package ) ,it still gave me the same error.
so what should it been add after --with-oci8?
I did a lot researchs, all says the --with-oci8 has been poin to oracle_home ,but do I have to install a oracle client at my webserver to eanble php connect to oracle database?
thanks in advance!
Old 11-09-2006, 10:29 PM   #2
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
You have only have to install Oracle InstantClient.
Edit httpd.conf
and rebuild php

I had troubles too. so I took notes...
Please let me know if there are ommisions...


or here:

Basic Software Installation Summary

* Fedora 4
* instantclient_10_2 the .zip files
* apache 1.3.31
* php 5.1.1

Oracle 10g Instant Client (free download available from Technet) is the easiest way for PHP to connect to a remote Oracle database, requiring installation of only three libraries.

Rebuild apache to add PHP support.

cd apache_1.3.31

./configure --with-layout=GNU \
--enable-module=so \
make install

Add to httpd.conf

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

Installing PHP-5.1.1 (not 5.1.6) with the OCI8 Extension

without using rpm's I used the .zip files

I did not apply a PHP patch for oci8 install

1. Download PHP-5.1.1 and unpack it.
2. Download the Basic and the SDK Instant Client packages from the Instant Client page on OTN.
3. Install the ZIP-Files as the root user into oinstall account.

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

Yes, I created an oinstall account. Previous client installs demanded it, and I don't want to mess around...

[root@bilbo instantclient_10_2]# pwd

[root@bilbo ~]$ unzip
inflating: instantclient_10_2/classes12.jar
inflating: instantclient_10_2/
inflating: instantclient_10_2/
inflating: instantclient_10_2/
inflating: instantclient_10_2/
inflating: instantclient_10_2/
inflating: instantclient_10_2/ojdbc14.jar

[root@bilbo ~]$ unzip

I had some errors first try and I remembered reading something about the sym links to the libs, so just to be safe...

[@bilbo ~]$ cd instantclient_10_2/
[oinstall@bilbo instantclient_10_2]$ ln -s
[oinstall@bilbo instantclient_10_2]$ ln -s

[oinstall@bilbo instantclient_10_2]$ ls -l
total 97592
-r--r--r-- 1 root root 1594191 Feb 5 2006 classes12.jar
lrwxrwxrwx 1 oinstall dba 17 Nov 9 17:12 ->
-rwxrwxr-x 1 root root 18774535 Feb 5 2006
-r-xr-xr-x 1 root root 5623929 Feb 5 2006
lrwxrwxrwx 1 oinstall dba 15 Nov 9 17:13 ->
-rwxrwxr-x 1 root root 1398088 Feb 5 2006
-rwxrwxr-x 1 root root 70690282 Feb 5 2006
-r-xr-xr-x 1 root root 119919 Feb 5 2006
-r--r--r-- 1 root root 1540457 Feb 5 2006 ojdbc14.jar
drwxrwxr-x 4 root root 4096 Feb 5 2006 sdk

4. Rebuild the configure script in the top-level PHP directory.

cd /usr/local/src/php-5.1.1
rm -rf config.cache
./buildconf --force

5. Rebuild PHP

[root@bilbo php-5.1.1]# ./configure
--with-oci8-instant-client=/home/oinstall/instantclient_10_2/ \
--prefix=/usr/local/php \
--with-apxs=/usr/local/apache1.3.31/sbin/apxs \
--enable-sigchild \

Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |

Thank you for using PHP.

[root@bilbo php-5.1.1]# make

-- stuff deleted ---

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

[root@bilbo php-5.1.1]# make install
Installing PHP SAPI module: apache
[activating module `php5' in /usr/local/apache1.3.31/etc/httpd.conf]
cp libs/ /usr/local/apache1.3.31/libexec/
chmod 755 /usr/local/apache1.3.31/libexec/
cp /usr/local/apache1.3.31/etc/httpd.conf /usr/local/apache1.3.31/etc/httpd.conf.bak
cp /usr/local/apache1.3.31/etc/ /usr/local/apache1.3.31/etc/httpd.conf
rm /usr/local/apache1.3.31/etc/
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.4.9
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php/include/php/ext/pdo/

When done edit php.ini (in apache conf - the location given by --with-config-file-path):
You may want to add: /usr/local/php/lib/php to your php.ini include_path
I did...

Restart Apache. I created a script...





echo Starting Apache
./apachectl start

That's it. Restart apache. Test PHP and look for oci8.
Old 11-10-2006, 08:53 AM   #3
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
thanks! alot , it's very detail! I'm appreciate your time and help!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
php with oci8 nightmare mariogomide Programming 1 01-31-2006 11:51 PM
How to rebuild php rpm package for oci8 in RHLE 4.0 nui Linux - Enterprise 2 08-01-2005 03:18 AM
Help with OCI8/PHP APACHE on Redhat enterprise AS 3.0 pdave Linux - Software 0 07-21-2004 11:12 AM
oracle9i on slackware9.1 or 10 raoqn Slackware 0 06-27-2004 11:20 PM
Oracle9i Client ONLY jpbarto Linux - Software 0 09-23-2003 01:58 PM

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration