# Oracle support in PHP? Use flag ignored?

## cayenne

Hello all!

I've succesfully, installed Apache, PHP, and PostgreSQL...gotten them all to work. Now turning my attention to try to create some useful PHP/Apache apps here at work to work with my Oracle databases. On my first try, I got this error:

Fatal error: Call to undefined function: ora_logon() in /home/httpd/php/oracle_test.php on line 10

When looked around for this error, most posts indicted that Oracle support had not been compiled into PHP. I looked in the phpinfo() page I created, and sure enough, I did not see anything like: 

 --with-oracle=/path/to/oracle/home/dir

  --with-oci8=/path/to/oracle/home/dir

Here is the info from the phpinfo() call:

'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--without-readline' '--with-apxs=/usr/sbin/apxs' '--without-db3' '--without-db4' '--without-db2' '--with-mcrypt=/usr' '--with-mhash' '--with-interbase=/opt/interbase' '--with-ming=/usr' '--with-swf=/usr' '--with-sybase=/usr' '--with-gdbm=/usr' '--with-java=/opt/blackdown-jdk-1.4.1' '--with-mcal=/usr' '--with-unixODBC=/usr' '--with-pgsql=/usr' '--with-snmp' '--enable-ucd-snmp-hack' '--with-xpm-dir=/usr/X11R6' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png-dir=/usr' '--with-jpeg' '--with-jpeg-dir=/usr' '--enable-exif' '--without-jpeg' '--with-tiff-dir=/usr' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-ttf' '--with-t1lib' '--with-gettext' '--with-qtdom' '--with-pspell' '--with-openssl' '--without-curl' '--with-imap' '--with-ldap' '--with-dom' '--with-dom-xslt' '--with-kerberos' '--with-pam' '--disable-memory-limit' '--disable-ipv6' '--enable-dbx' '--with-imap-ssl' '--with-zlib' '--with-zlib-dir=/usr/lib' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring' '--enable-mbregex' '--with-bz2' '--with-crack' '--with-ndbm' '--with-cdb' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro' '--enable-ftp' '--with-mime-magic' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc' '--with-iconv' '--enable-shmop' '--enable-dio' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-config-file-path=/etc/php/apache1-php4' 

I checked my USE flags in make.conf, and I to have oci8 in there:

USE="X -gtk -gnome alsa acl acpi arts avi -cdr crypt cups dga emacs encode esd fbcon firebird flash freetds gd gdbm gif gphoto2 gpm guile imap imlib innodb jack java jikes jpeg kde kerberos ladcca lcms ldap libwww mbox mcal mysql nas ncurses nls oci8 odbc oggvorbis opengl oss pam pcmcia pdflib perl png pnp postgres python qt quicktime readline samba sdl snmp spell sse ssl svga tcltk tetex tiff truetype usb Xaw3d xml xml2 xmms sv zeo zlib x86"

So, my question is...what happened? How do I get oracle support compiled into PHP on my Gentoo box?

Thanks in advance!!

cayenne

----------

## Genone

I guess it's a bug for https://bugs.gentoo.org

----------

## tangent

I had that problem too. After scanning through php.eclass I noticed that the condition to compile --with-oci8 requires both the oci8 flag and ORACLE_HOME to be set. Didn't have that set for root so I set that and remerged. Now I'm getting compile errors in oci8.c, have to sort that out tommorrow. hrrmph...

----------

## cayenne

 *tangent wrote:*   

> I had that problem too. After scanning through php.eclass I noticed that the condition to compile --with-oci8 requires both the oci8 flag and ORACLE_HOME to be set. Didn't have that set for root so I set that and remerged. Now I'm getting compile errors in oci8.c, have to sort that out tommorrow. hrrmph...

 

So...just to be clear...If I have oci8 in my USE flags in make.conf, and I have the env variable ORACLE_HOME set in root...it will pick all that up if I re emerge PHP? 

TIA,

cayenne

----------

## cayenne

Ok...my root user has ORACLE_HOME set. I double checked, and oci8 is in my USE flags in make.conf. Howerver, when I was trying to re-emerge mod_php...I was watching, and it specifically said NO support for Oracle being put in.

I've been trying to figure things out...the only thing I can think of is that I have Oracle 9.0.2 client tools installed...would the fact that it isn't oracle 8i be the problem? I mean, mod_php is only going to be using the Oracle Net tools for the connections, right? Should it matter what version?

cayenne

----------

## cayenne

Ok...maybe it should have been obvious to me...but, took me a bit.

The oci8 ONLY allows you to use the ocixxx commands, not the ora_xxx ones.

Took me a bit to see on the http://www.php.net/manual/en/ref.oracle.php page, which is the first place I went to find the oracle commands...there is a little link on the top of that page to take you to the OCI extensions. Color me slow, but, didn't dawn on me till just a minute ago when I tried my test script replacing all the ora_ calls with oci calls...and voila..it worked.

Ok..so, the USE flag, oci9 allows you to use the oci php extensions....How to you set a flag in USE to allow it to also use the ora_ commands? 

Can you put something like 'oracle' as a USE flag...what happens if you put a flag in there, that isn't officially listed on the gentoo USE flag page? Will it work? Will it be ignored?

Maybe a larger question is...how to you put in compile flags for a program you are emerging, but, isn't covered in the USE flag part of make.conf?

----------

## Arkanjo

I agree, this is not right how can one guess that to have OCI support you have to do all this, i was lucky to find the post and even now i ask the same question: how to enable the ora_... functions ???

----------

## ausmusj1

Edit the /usr/portage/eclass/php-sapi.eclass file, and add the line:

```

myconf="${myconf} --with-oracle"

```

You'll want to make sure that your ORACLE_HOME environment variable is properly set before running the emerge, however, as the Oracle extension does need the client installed.

HTH

-James

----------

## jfalberts

Hi,

I'm having exactly the same trouble.  I installed the Oracle 8.1.7 client, set my ORACLE_HOME for root and also made sure that oci8 is in my USE flags.  I then emerged apache mod_php and mysql.  Afterwards I ran ebuild mod_php-4.3.6_rc2.ebuild config, but oci 8 support is not being compiled into my php.  When I try to use OCILogon I get Fatal error: Call to undefined function: ocilogon().  Here's my configure command from PHPInfo:

'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr' '--without-interbase' '--without-ming' '--without-swf' '--with-sybase=/usr' '--with-gdbm=/usr' '--without-fdftk' '--with-java=/opt/blackdown-jdk-1.4.1' '--without-mcal' '--with-unixODBC=/usr' '--without-pgsql' '--with-snmp=/usr' '--enable-ucd-snmp-hack' '--with-xpm-dir=/usr/X11R6' '--with-gmp' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png=/usr' '--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' '--with-tiff-dir=/usr' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext' '--with-qtdom=/usr/qt/3' '--with-pspell=/usr' '--with-openssl=/usr' '--without-imap' '--with-ldap=/usr' '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--disable-memory-limit' '--enable-ipv6' '--without-yaz' '--without-curl' '--enable-dbx' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' '--enable-pcntl' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro' '--enable-ftp' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc' '--with-iconv' '--enable-shmop' '--enable-dio' '--enable-yp' '--without-ncurses' '--without-readline' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-config-file-path=/etc/php/apache2-php4' 

No Oracle support in there anywhere.  Please help, I'm really getting desperate!  How can I get Oracle support into my PHP.  Everything else works fine, just not the OCI functions.    :Crying or Very sad: 

Thanx

----------

