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

Notices

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

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


hi,
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/10.2.0.1/client/lib(where 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
alar
Member
 
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...

here:
http://athlone.homelinux.net/htdocs/...l#Installation

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 \
--prefix=/usr/local/apache1.3.31
make
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
/home/oinstall/instantclient_10_2

[root@bilbo ~]$ unzip instantclient-basic-linux32-10.2.0.2-20060331.zip
Archive: instantclient-basic-linux32-10.2.0.2-20060331.zip
inflating: instantclient_10_2/classes12.jar
inflating: instantclient_10_2/libclntsh.so.10.1
inflating: instantclient_10_2/libnnz10.so
inflating: instantclient_10_2/libocci.so.10.1
inflating: instantclient_10_2/libociei.so
inflating: instantclient_10_2/libocijdbc10.so
inflating: instantclient_10_2/ojdbc14.jar

[root@bilbo ~]$ unzip instantclient-sdk-linux32-10.2.0.2-20060331.zip


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 libclntsh.so.10.1 libclntsh.so
[oinstall@bilbo instantclient_10_2]$ ln -s libocci.so.10.1 libocci.so

[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 libclntsh.so -> libclntsh.so.10.1
-rwxrwxr-x 1 root root 18774535 Feb 5 2006 libclntsh.so.10.1
-r-xr-xr-x 1 root root 5623929 Feb 5 2006 libnnz10.so
lrwxrwxrwx 1 oinstall dba 15 Nov 9 17:13 libocci.so -> libocci.so.10.1
-rwxrwxr-x 1 root root 1398088 Feb 5 2006 libocci.so.10.1
-rwxrwxr-x 1 root root 70690282 Feb 5 2006 libociei.so
-r-xr-xr-x 1 root root 119919 Feb 5 2006 libocijdbc10.so
-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 \
--with-config-file-path=/usr/local/apache1.3.31/etc


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/libphp5.so /usr/local/apache1.3.31/libexec/libphp5.so
chmod 755 /usr/local/apache1.3.31/libexec/libphp5.so
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/httpd.conf.new /usr/local/apache1.3.31/etc/httpd.conf
rm /usr/local/apache1.3.31/etc/httpd.conf.new
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...

#!/bin/sh
APACHEHOME=/usr/local/apache1.3.31

LD_LIBRARY_PATH=/home/oinstall/instantclient_10_2/

TNS_ADMIN=/home/oinstall/instantclient_10_2
export LD_LIBRARY_PATH TNS_ADMIN

echo "LD_LIBRARY_PATH : $LD_LIBRARY_PATH"
echo "TNS_ADMIN: $TNS_ADMIN"

echo Starting Apache
./apachectl start


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

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


Reply


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
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration