LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-16-2004, 01:57 PM   #1
dominant
Member
 
Registered: Jan 2004
Posts: 409

Rep: Reputation: 30
php & oracle 9i


I have installed my system SUSE 9 pro, oracle 9i R2.
Now i want php to be able to connect with the oracle database server?
What should i configure to do that?
 
Old 07-19-2004, 01:42 AM   #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
Oracle9, Oracle8 and Oracle7 databases use the Oracle Call Interface (OCI).

I used my own httpd (apache). Not the one that came with Oracle:

# tar zxvf php-4.3.3.tar.gz
# cd php-4.3.3
# ./configure --with-oci8=$ORACLE_HOME \
--with-apxs=/usr/local/apache1.3.28/sbin/apxs \
--enable-sigchild
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini

For more notes:
http://www3.sympatico.ca/arothmel/ht...l#Installation

Hope this helps
 
Old 07-19-2004, 02:52 AM   #3
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
I found an alternative solution

Well, i have a php application (php installed). Well i could erease the php using rpm (i don;t know what is going with the shared libraries)

I could just install the perl module DBD::Oracle that will do the job for me, write the result set into a file and the php will read it.

The problem ,of course, is that the script wich connect to the database is going to be run very often and i am supposed to be careful with the file (result set) creating to avoid some kind of colisions. (error writing to file)
 
Old 07-19-2004, 03:28 AM   #4
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
Did you install PHP yourself? What I am asking is if you built it originally
you could just rebuild it with the oci configuration.
I don't think it would hurt you to do a new PHP install either...

I'm not particularily fond of DBD::Oracle, but I'm not strong in Perl either

You also have to be sure your apache is configured with libpthread.so.0

If your webserver doesn't start or crashes at startup: Check that Apache is linked with the pthread library:

[root@frodo src]# ldd /usr/local/apache1.3.28/sbin/httpd
libm.so.6 => /lib/libm.so.6 (0x40029000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004b000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x40078000)
libdl.so.2 => /lib/libdl.so.2 (0x40098000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4009b000)
libc.so.6 => /lib/libc.so.6 (0x400ed000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Good luck
 
Old 07-19-2004, 04:23 AM   #5
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
php installed automatically (using yast, SUSE 9 PRO)

How to rebuild it and add the OCI, without uninstalling the php
(i scared about system's stability)
Not much experienced.
 
Old 07-19-2004, 11:03 AM   #6
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
In case you are worried about the system. What's the worst thing that can happen?
Your Oracle Install will be okay even if you do re-install the OS. Provided you
created a seperate mount point for the Oracle Install and don't reformat it

I even have my mail and working directories on a seperate mount point from the Linux install. This way I can install a new OS and not lose everything.

Not that you'll have to though....

If you are happy with RPM by all means use it to remove the old PHP, but I
would recommend building PHP and maybe even a new Apache on your own.

It's not nearly as fussy as an Oracle install and you have already done that.

Test if your Apache has been linked with the pthread library:
ldd /usr/local/apache1.3.28/sbin/httpd

Just download php-4.3.3.tar.gz. Create a dir ie /usr/MyPrograms doesn't matter
where. Untar the file. # cd php-4.3.3

./configure --with-oci8=/u01/oracle/product/8.1.7 --with-apxs=/usr/local/apache1.3.28/sbin/apxs --enable-sigchild

Then PHP becomes part of Apache. You'll have to modify your Apache config as well.
Open httpd.conf and look for PHP. Uncomment or edit.

Finally copy lib to local library
cp php.ini-dist /usr/local/lib/php.ini

You now have PHP on Apache that is ready to talk to Oracle.

Quote:
(i scared about system's stability)
Hope your not scared anymore
Good Luck!
alar
 
Old 07-19-2004, 11:13 AM   #7
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
here are the share libraries for my httpd

Code:
#  ldd /usr/sbin/httpd
        libmm.so.13 => /usr/lib/libmm.so.13 (0x40028000)
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x4002c000)
        libm.so.6 => /lib/i686/libm.so.6 (0x4007d000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x400a0000)
        libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0x400d3000)
        libgdbm_compat.so.3 => /usr/lib/libgdbm_compat.so.3 (0x400d9000)
        libdb-4.1.so => /usr/lib/libdb-4.1.so (0x400dc000)
        libexpat.so.0 => /usr/lib/libexpat.so.0 (0x401a0000)
        libdl.so.2 => /lib/libdl.so.2 (0x401c0000)
        libc.so.6 => /lib/i686/libc.so.6 (0x401c3000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
When i run the phpinfo i can see the ./configure command with all the options.

If i retype those options with the oracle option, as well. Is it going to work with IMAP, FTP, GD, and other extentions?
 
Old 07-19-2004, 12:08 PM   #8
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
Apache looks good.

If you can rebuild PHP that would be the easiest!!!

That's why I don't like RPM. Cause I don't understand it.

In phpinfo()

What does your Configure Command './configure' '--with-oci8=/u01/oracle/product/8.1.7' '--with-apxs=/usr/local/apache1.3.28/sbin/apxs' '--enable-sigchild'
say?
 
Old 07-20-2004, 02:58 AM   #9
dominant
Member
 
Registered: Jan 2004
Posts: 409

Original Poster
Rep: Reputation: 30
How to rebuild the php?

Here is the phpinfo()


'./configure' '--prefix=/usr/share' '--datadir=/usr/share/php' '--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' '--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' '--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--enable-wddx' '--enable-yp' '--with-bz2' '--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' '--with-gettext' '--with-gmp' '--with-imap=yes' '--with-iodbc' '--with-jpeg-dir=/usr' '--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-pgsql=/usr' '--with-png-dir=/usr' '--with-readline' '--with-snmp' '--with-t1lib' '--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' '--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' '--with-gd' '--with-openssl' '--with-curl' '--with-swf=/usr/src/packages/BUILD/swf/dist/' '--with-imap-ssl' '--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' '--with-apxs=/usr/sbin/apxs' 'i586-suse-linux'

Last edited by dominant; 07-20-2004 at 02:59 AM.
 
Old 07-20-2004, 11:18 AM   #10
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
Hmmm. I think I would do a new install in usr/local/
Sort of an Oracle only PHP install, and leave the existing one alone.

Your existing php.ini is probably in /etc so you won't have conflicts
if you put the new install php.ini in /usr/local/lib/php.ini

I took notes during my install...

Please see:
http://www3.sympatico.ca/arothmel/ht...tml#InstallPHP

It doesn't really matter where you install it as long as you don't tromp on the existing install in the /usr and /usr/share etc.

So you build php and tell it where Apache and Oracle are.
That should be it.


From my notes:

Install PHP>

Apache is installed, so you can now install PHP. You will uncompress the PHP package, giving you a directory named "php-4.3.2". You must change into this directory. Use the standard UNIX/Linux way of building and installing software from source; configure, make, and then make install.

Notes:

* At this point I would suggest logging in as Oracle User and then # su root, without the '-'; keeping your Oracle environment intact.
* If you get an error about apxs and you see the help screen from apxs displayed, then you need to recompile Apache and ensure that --enable-module=so is specified to the configure command. - See above.


Check PHP site for further documentation oci8 with PHP. (A good reference to the OCI method and how it is more flexible than the standard Oracle extension.)

# tar zxvf php-4.3.3.tar.gz
# cd php-4.3.3
# ./configure --with-oci8=$ORACLE_HOME \
--with-apxs=/usr/local/apache1.3.28/sbin/apxs \
--enable-sigchild
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini

You must also edit the httpd.conf file which is usually located in /where/ever/apache/conf. You must add the following lines:

#
# This will load the PHP module into Apache.
# Put this line with other LoadModule lines.
#
LoadModule php4_module
libexec/libphp4.so
#
# This next section will add a handler for .php files,
# put it with other IfModule lines.
#
<IfModule mod_php4.c>
AddType application/x-httpd-php .php

</IfModule>

Have fun!
alar
 
  


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
Compiling php with oracle support fintan Linux - Software 1 12-31-2006 01:34 PM
PHP Oracle 9i Configure netpicker9 Mandriva 0 05-05-2005 02:47 AM
PHP Oracle 9i Connection Problem (RH9) dhammika Linux - Software 8 03-28-2005 03:18 PM
Please help with PHP/Oracle RPM install on RH9 pnovess Linux - Newbie 0 08-08-2003 05:54 PM
oracle 9i and php ronald_fancher Linux - General 9 03-04-2003 09:11 AM


All times are GMT -5. The time now is 01:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration