Why do I get "undefined reference" errors when making Apache and PHP with the ODBC-ODBC Bridge?

For example:

modules/php3/libphp3.a(unified_odbc.o): In function `_free_result':
/work/builds/php-3.0.11/functions/unified_odbc.c:192: undefined reference to `SQLFreeStmt'
modules/php3/libphp3.a(unified_odbc.o): In function `_results_cleanup':
/work/builds/php-3.0.11/functions/unified_odbc.c:208: undefined reference to `SQLFreeStmt'

Look at the linker line before the undefined reference messages start and check that there is a -lesoobclient flag. If this is missing, you have probably misconfigured PHP as described below. You can usually check this is what has happened by doing a grep for esoobclient in the top-level Makefile. For example:

/work/php-3.0.12-> grep esoobclient Makefile

which should show something like:

LIBS = -lgd pcrelib/libpcre.a regex/libregex.a -lgdbm
-L/usr/local/easysoft/oob/client/lib -lesoobclient
-lgd -lm -ldl -lcrypt -lnsl -lresolv

The actual output depends on the platform, but should contain -lesoobclient.

The CUSTOM_ODBC_LIBS variable defines the name of the shared object that provides the ODBC driver. In this case, this is the ODBC-ODBC Bridge client shared object (libesoobclient.so, the extension depends on the platform and may be .a or .sl). If the CUSTOM_ODBC_LIBS variable was not set before making PHP, Apache will not include a reference to the shared object containing the SQL functions and hence the undefined references. Refer to the Apache_PHP text file in the docs directory of the distribution.

You can also add CUSTOM_ODBC_LIBS to your environment. For example:

$ CUSTOM_ODBC_LIBS="-lesoobclient"
$ export CUSTOM_ODBC_LIBS