Page 1 of 1

Upgrading PHP and adding Oracle support

Posted: Wed Nov 20, 2002 10:04 pm
by swhite58
Brace yourselves, this is a newbie talking. I have a question that's as much a Linux question as a PHP one, and I'm new to both.

I installed Red Hat Linux 7.1, including PHP and PHP/mySQL support, on a server at work. I have phpBB and phpmyadmin up and running, and have been experimenting with writing PHP code - great fun.

Now I would like to upgrade PHP from 4.04 pl1 to the current version. I would also like to add Oracle 7 support so I can write web-based reporting tools for end users.

But how do I do this? I downloaded the PHP rpms but I got a string of dependency errors. If I get the standard tar.gz and unzip/untar that, won't I be creating a lot of inconsistencies? People do this every day. I must be missing something obvious :)

The second part of my question is about oracle support. According to the PHP manual, I'm supposed to do something like:

Code: Select all

./configure --with-oracle
I'm not familiar with this at all. From where do I run this?

If I do a phpinfo() the configure command param looks like this:

Code: Select all

'./configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle' '--without-oci8' '--with-xml'
BTW, notice it says 'without-mysql' when I do seem to have mySQL support. Hmm.

Any help would be greatly appreciated!

Thanks

Shane

Posted: Thu Nov 21, 2002 10:48 am
by BDKR
Hey,

Red Hat and many of the other RPM based Linux distro's configure PHP with Oracle. However, adding support may just be a matter of checking the installation disk to see if there is a php rpm file with support for what you need. It might look something like
php-pgsql-yada_yada.i386.rpm
I personally build my own servers as opposed to using what's provided.
But how do I do this? I downloaded the PHP rpms but I got a string of dependency errors. If I get the standard tar.gz and unzip/untar that, won't I be creating a lot of inconsistencies? People do this every day. I must be missing something obvious
The first thing I would say to do is uninstall all rpm's having anything to do with PHP.

The second part of my question is about oracle support. According to the PHP manual, I'm supposed to do something like:
Code:
./configure --with-oracle
This is related to the first statment. If you were to continue using the rpms, then the above line is not needed. Otherwise, if you configure and compile your own server, then the above line is very mcuh needed and correct.

It's all rather simple actually. Just download the tar.gz file and read the INSTALL file once you've un-compressed everything.

Drop a note if you have more questions.

Cheers,
BDKR

Posted: Thu Nov 21, 2002 10:51 am
by BDKR
I forgot. You could also check rpmfind.net to see if there are any php-oracle rpm files that will work with your version of Red Hat.

Cheers,
BDKR

Posted: Sun Nov 24, 2002 7:36 pm
by swhite58
Thanks very much for the advice - it's all a lot clearer.

I downloaded the latest PHP source, uninstalled all the PHP rpms and compiled the new version as per the manual. The configure options (from phpinfo() ) included

Code: Select all

'--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--with-mysql' '--with-oracle-dir=/usr/oracle' '--without-oci8' '--with-xml'
There is a working Oracle 7.3.4 client at /usr/oracle

PHP works fine, except it doesn't recognise Oracle functions like ora_logon

The error mesage I get is
PHP Fatal error: Call to undefined function: ora_logon() in /usr/local/download/oracle_test.php on line 5
Is there something I still need to do to to set up Oracle support, perhaps in Apache?

Thanks

Shane

Posted: Mon Nov 25, 2002 7:28 am
by BDKR
Well, since I don't use Oracle myself, it's tough for me to ascertain what's going on. However, I did do a ./configure --help and took a look at the configuration options. I notided that for Oracle support (not Oracle 8) it says the default directory is ORACLE_HOME. That looks like an environment variable to me.

In a shell (Xterm, aterm, wterm, if you're using X), type in "export | less" and see if there is a ORACLE_HOME variable there. It may look something like

Code: Select all

declare -x ORACLE_HOME="yada yada yada"
If there is one there, make sure it is the same thing that's entered into your configuration line.

Hope that helps.

Cheers,
BDKR

Posted: Wed Nov 27, 2002 7:21 pm
by swhite58
The oracle path is correct. Just in case, I made sure ORACLE_HOME was in the environment, and ran configure again, this time not specifying an oracle directory. It ran ok.

When I tried make, the response was:
Making all in Zend
make[1]: Entering directory `/tmp/php-4.2.3/Zend'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/tmp/php-4.2.3/Zend'
Making all in main
make[1]: Entering directory `/tmp/php-4.2.3/main'
make[2]: Entering directory `/tmp/php-4.2.3/main'
/bin/sh /tmp/php-4.2.3/libtool --silent --mode=compile gcc -I. -I/tmp/php-4.2.3/main -I/tmp/
php-4.2.3/main -I/tmp/php-4.2.3 -I/usr/include/apache -I/tmp/php-4.2.3/Zend -I/tmp/php-4.2.3/
ext/mysql/libmysql -I/tmp/php-4.2.3/ext/xml/expat -DLINUX=22 -DMOD_SSL=208101 -DEAPI -DEAPI_
MM -DUSE_EXPAT -I/tmp/php-4.2.3/TSRM -g -O2 -prefer-pic -c internal_functions.c
In file included from internal_functions.c:39:
/tmp/php-4.2.3/ext/oracle/php_oracle.h:22:22: oratypes.h: No such file or directory
/tmp/php-4.2.3/ext/oracle/php_oracle.h:23:20: ocidfn.h: No such file or directory
/tmp/php-4.2.3/ext/oracle/php_oracle.h:24:20: ociapr.h: No such file or directory
make[2]: *** [internal_functions.lo] Error 1
make[2]: Leaving directory `/tmp/php-4.2.3/main'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/php-4.2.3/main'
make: *** [all-recursive] Error 1
Not very encouraging.

Any ideas as to what is going on?

BTW if the moderator doesn't mind it might be useful to move this thread to the databases forum.

Thanks

Shane

Posted: Thu Nov 28, 2002 2:23 am
by twigletmac
swhite58 wrote:BTW if the moderator doesn't mind it might be useful to move this thread to the databases forum.
Was just thinking the same thing. Thread now moved :) .

Mac

Posted: Thu Nov 28, 2002 9:34 am
by BDKR
Really, as I've never had to install using oracle, this is stretching my knowledge a good deal.

However, did find it interesting that 3 of the lines were talking about not being able to find header files. Did you notice that? If you downloaded this from php.net, why would the files not be there?

Try running config and make as root. Maybe this is a permissions problem.

Cheers,
BDKR

Posted: Fri Nov 29, 2002 12:02 am
by swhite58
8O

Light has dawned.
/tmp/php-4.2.3/ext/oracle/php_oracle.h:22:22: oratypes.h: No such file or directory
/tmp/php-4.2.3/ext/oracle/php_oracle.h:23:20: ocidfn.h: No such file or directory
/tmp/php-4.2.3/ext/oracle/php_oracle.h:24:20: ociapr.h: No such file or directory
php_oracle.h is ok, but the 3 other header files should be part of the oracle client I have installed on the linux box. However, the client is a cut down version supplied by the vendors of an application I installed earlier. These files are not present. I don't have a separate license for this client, so I can't get hold of the files.

So, I guess I'll look into ODBC, unless anyone has another suggestion.

:cry:

Thanks

Shane

Posted: Fri Nov 29, 2002 7:16 am
by BDKR
Do you have a license for the Oracle db you guys are using? More often than not, if you can show ownership, the company will work with you. I 've been down a similar road with Cisco and getting a copy of their IOS for a 1750.

If whatever ODBC prog you use is as good as MyODBC, you won't have many problems.

Cheers,
BDKR

Posted: Fri Nov 29, 2002 11:34 am
by hedge
I managed to get it working on RH7 a few months ago. Here are my notes:
---------------------------------------------------------------------------------
1. install jre116
2. install oracle, full install not just client or php compile will complain about missing files
3. compile php : - make distclean
./configure --with-apxs --with-oci8=$ORACLE_HOME --enable-trans-sid
make
make install
4. add line $ORACLE_HOME/lib to /etc/ld.so.conf, run ldconfig
5. add line export LD_PRELOAD=libclntsh.so.8.0 to start section of httpd script
add line export ORACLE_HOME=$ORACLE_HOME to start section of httpd script
-------------------------------------------------------------------------------

From my notes it seems that I needed the full install of Oracle. At that time you could download the entire db install for linux from the oracle site. It is a java installer that needs X to run, I think there is a way to install without it but I took the easy route.

I was using the ora815 version but it can connect to both 7.3.4 and 8.1.7 databases.

I also had trouble finding the tnsnames.ora so I had to embed the entire tns entry in the connect string.