LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   php & oracle 9i (https://www.linuxquestions.org/questions/linux-newbie-8/php-and-oracle-9i-205907/)

dominant 07-16-2004 12:57 PM

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?

alar 07-19-2004 12:42 AM

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
:)

dominant 07-19-2004 01:52 AM

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)

alar 07-19-2004 02:28 AM

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 :)

dominant 07-19-2004 03:23 AM

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.

alar 07-19-2004 10:03 AM

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

dominant 07-19-2004 10:13 AM

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?

alar 07-19-2004 11:08 AM

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?

dominant 07-20-2004 01:58 AM

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'

alar 07-20-2004 10:18 AM

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


All times are GMT -5. The time now is 12:46 PM.