Wednesday, March 18, 2009

Compiling Oracle9i support on PHP 5.1.2

Today had to re-compile the PHP from a server on which the Oracle was rolled back a notch, from 10 to 9 (the reason for this should remain behind a curtain, the thicker and the fucking heavier, the better ;) )

Never used Oracle9 before, nor compiled PHP for it, so it was a day of first times.
Tried to use the same configure settings that I used to compile PHP (the same version) but when the server had Oracle10:

./configure \
--prefix=/usr/local/php-5.1.2 \
--with-config-file-path=/usr/local/php-5.1.2/config/php.ini \
--with-apxs2=/usr/local/apache_2.0.55/bin/apxs \
--with-oci8=$ORACLE_HOME \
--enable-sigchild \
--with-openssl \
--with-zlib \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--enable-gd-native-ttf \
--with-png \
--with-ldap \
--enable-mbstring \
--enable-mbregex \
--with-mysql \
--enable-sockets \
--with-pear \
--with-mcrypt \
--with-openssl \

The './configure' went Ok, but it belched with this error during the make:

ext/oci8/.libs/oci8.o(.text+0x22f5): In function `php_oci_do_connect_ex':
/home/dba_ultrasmooth_operator/downloads/http/php-5.1.2/ext/oci8/oci8.c:1346: undefined reference to `OCIPing'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

Off to Google I went for help., but found nothing, with the same error message, so I expanded a bit the search.
Apparently, one solution it is to link some of Oracle libraries from the version 9, and make a link that points from the version 8, to the actual version 9 library.
Tested that, but it didn't work either.

What I did in the end, and it worked A Ok, was to edit the 'oci8.c', the line that belched, comment it:

// OCI_G(errcode) = PHP_OCI_CALL(OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));

So it doesn't perform that check during the make stage.

After that, everything went Ok.

Labels: , , ,


Post a Comment

<< Home