php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20715 IBM-DB2 don't compile
Submitted: 2002-11-29 04:12 UTC Modified: 2003-03-10 21:13 UTC
From: bruno at cameleons dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.3.1 OS: Linux 2.4.19
Private report: No CVE-ID:
 [2002-11-29 04:12 UTC] bruno at cameleons dot net
hi,
I need to compile IBM DB2 support on PHP with Apache 2. With the 4.2.3, i've the problem with file_exists function and relative path. So, i downloaded the 4.3.0RC2 version. Everything compile fine but the ODBC module don't work. Apache send this message:
/usr/sbin/httpd: relocation error: /usr/lib/php4/odbc.so: undefined symbol: SQLAllocEnv

When i do a ldd command on odbc.so:
        libc.so.6 => /lib/libc.so.6 (0x40011000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

on the 4.2.3 version, the same command do this result: 
       libdb2.so.1 => /usr/IBMdb2/V7.1/lib/libdb2.so.1 (0x4001b000)
        libc.so.6 => /lib/libc.so.6 (0x40843000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4096a000)
        libdl.so.2 => /lib/libdl.so.2 (0x40997000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x4099a000)
        libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0x409af000)
        libm.so.6 => /lib/libm.so.6 (0x409f1000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Here's my configure:
CFLAGS="-O2 -march=i686 -funroll-loops -D_REENTRANT -fPIC"; export CFLAGS
LIBS="-lttf -lfreetype -lpng -ljpeg -lz -lnsl"; export LIBS
EXTENSION_DIR=/usr/lib/php4; export EXTENSION_DIR
IMAP_SHARED_LIBADD=-lc-client ; export IMAP_SHARED_LIBADD

./buildconf
./configure \
--prefix=/usr \
--with-layout=GNU \
--with-apxs2=/usr/sbin/apxs \
--with-config-file-path=/etc/httpd \
--with-exec-dir=/usr/bin \
--with-openssl \
--with-zlib \
--with-bz2 \
--with-gd \
--with-ttf \
--with-png \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-freetype-dir=/usr \
--with-expat-dir=/usr \
--with-gmp \
--with-xml \
--with-imap=shared \
--with-imap-ssl \
--with-mysql=shared,/usr \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-ldap=shared \
--with-pspell \
--disable-debug \
--disable-posix \
--disable-rpath \
--enable-safe-mode \
--enable-magic-quotes \
--enable-bcmath \
--enable-dio \
--enable-gd-native-ttf \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--enable-pic \
--enable-inline-optimization \
--enable-memory-limit \
--enable-cli \
--enable-force-cgi-redirect \
--with-pear=/usr/share/pear \
--enable-discard-path \
--enable-track-vars \
--enable-ftp \
--with-pdflib=/usr \
--with-ibm-db2=shared,/usr/IBMdb2/V7.1 \
--with-oci8=shared,/usr/oracle/product/9.0.1

Thanks for help

Bruno Meneuvrier

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-05 19:51 UTC] kalowsky@php.net
Interestingly enough there have been no changes to the config.m4 with regards to the ibm-db2 section between those two versions.  Does this happen only with the db2 option selected?
 [2003-01-02 18:41 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-03-04 10:04 UTC] bruno at cameleons dot net
After 3 months, I've try again to compile PHP 4.3.1 with Apache 2 and IBM DB2 support but with no success.
I've tried with PHP 4.3.0, PHP 4.3.1 and PHP latest snapshot.
I've changed the DB2 version: 7.1 > 7.2.
The following configure line failed too:
./configure --with-ibm-db2=shared,/usr/IBMdb2/V7.1

Please Help!

Thanks
 [2003-03-04 10:09 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip


And don't sert any CFLAGS or so when you run configure..
(make sure those are not set in your environment either)

 [2003-03-04 10:19 UTC] kalowsky@php.net
Try building unixODBC on your machine, and using that as the interface to DB2.  It is currently the recommended means to connect to DB2 by IBM.  

Updating version as well.
 [2003-03-04 10:24 UTC] bruno at cameleons dot net
I've tried php4-STABLE-200303041230.tar.gz.
The command env return any CFLAGS and I enter this configure:
./configure --with-ibm-db2=shared,/usr/IBMdb2/V7.1 --disable-all

Bruno
 [2003-03-04 10:30 UTC] kalowsky@php.net
please try my request
 [2003-03-04 10:40 UTC] bruno at cameleons dot net
Ok, but is unixODBC faster or slower than DBConnect?
The syntaxe is compatible between UnixODBC and DB2connect?
I have 300 scripts PHP using odbc functions.
 [2003-03-04 11:43 UTC] kalowsky@php.net
The point of ODBC is that it is cross DB compatible.  It uses the same API that DB2 does, only IBM recommends using unixODBC to interface with DB2 rather than their own interface (which is still ODBC).

As for speed questions, this is typically irrelevent as you're still using an ODBC-ODBC bridge which can be tuned slightly depending upon your preferences.
 [2003-03-05 05:41 UTC] bruno at cameleons dot net
Hi,
I've the same problem with unixODBC. I've tried unixODBC shared with php 4.2.3: it works fine.
I've compiled unixODBC static with php 4.3.1: it works fine
I've compiled IBM DB2 static with php 4.3.1: it works fine.
It seems to be a problem with odbc shared.

Bruno
 [2003-03-06 22:37 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Note: Try the snapshot that is generated about 2 hours
since you get this notice email. There was a typo in the ext/odbc/config.m4 which is now fixed. It was most likely
the reason for this thing not working as shared extension.

 [2003-03-07 04:55 UTC] bruno at cameleons dot net
Hi,

It doesn't work.
I put below some extracts of my compile.

./configure \
--prefix=/usr \
--with-layout=GNU \
--with-apxs2=/usr/sbin/apxs \
--with-config-file-path=/etc/httpd \
--with-exec-dir=/usr/bin \
--with-ibm-db2=shared


/bin/sh /var/tmp/php4-STABLE-200303070830/libtool --silent --preserve-dup-deps --mode=compile gcc -I/home/db2inst1/sqllib/include -Iext/odbc/ -I/var/tmp/php4-STABLE-200303070830/ext/odbc/ -DPHP_ATOM_INC -I/var/tmp/php4-STABLE-200303070830/include -I/var/tmp/php4-STABLE-200303070830/main -I/var/tmp/php4-STABLE-200303070830 -I/usr/include/httpd -I/var/tmp/php4-STABLE-200303070830/Zend -I/var/tmp/php4-STABLE-200303070830/ext/xml/expat  -D_REENTRANT -D_SINGLE_LISTEN_UNSERIALIZED_ACCEPT -I/var/tmp/php4-STABLE-200303070830/TSRM  -g -O2  -prefer-pic -c /var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c -o ext/odbc/php_odbc.lo
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c: In function `safe_odbc_disconnect':
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:199: warning: passing arg 1 of `SQLDisconnect' makes integer from pointer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:202: warning: passing arg 1 of `SQLTransact' makes integer from pointer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:202: warning: passing arg 2 of `SQLTransact' makes integer from pointer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:203: warning: passing arg 1 of `SQLDisconnect' makes integer from pointer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c: In function `_close_odbc_conn':
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:229: warning: passing arg 1 of `safe_odbc_disconnect' makes pointer from integer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c: In function `_close_odbc_pconn':
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:257: warning: passing arg 1 of `safe_odbc_disconnect' makes pointer from integer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c: In function `zif_odbc_data_source':
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:1230: warning: passing arg 2 of `odbc_sql_error' makes integer from pointer without a cast
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c: In function `odbc_do_connect':
/var/tmp/php4-STABLE-200303070830/ext/odbc/php_odbc.c:2223: warning: passing arg 1 of `spprintf' from incompatible pointer type
/bin/sh /var/tmp/php4-STABLE-200303070830/libtool --silent --preserve-dup-deps --mode=link gcc -DPHP_ATOM_INC -I/var/tmp/php4-STABLE-200303070830/include -I/var/tmp/php4-STABLE-200303070830/main -I/var/tmp/php4-STABLE-200303070830 -I/usr/include/httpd -I/var/tmp/php4-STABLE-200303070830/Zend -I/var/tmp/php4-STABLE-200303070830/ext/xml/expat  -D_REENTRANT -D_SINGLE_LISTEN_UNSERIALIZED_ACCEPT -I/var/tmp/php4-STABLE-200303070830/TSRM  -g -O2   -o ext/odbc/odbc.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/php4-STABLE-200303070830/modules -avoid-version -module ext/odbc/php_odbc.lo
/bin/sh /var/tmp/php4-STABLE-200303070830/libtool --silent --preserve-dup-deps --mode=install cp ext/odbc/odbc.la /var/tmp/php4-STABLE-200303070830/modules
PATH="$PATH:/sbin" ldconfig -n /var/tmp/php4-STABLE-200303070830/modules


[root@intranet php4-STABLE-200303070830]# ldd modules/odbc.so
        libc.so.6 => /lib/libc.so.6 (0x40012000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Bruno
 [2003-03-10 21:13 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 21:01:56 2014 UTC