Problems with PostgreSQL 8, and PHP 5.2, on Mac OS X

2011/07/14

Categories: GeekStuff

For future reference:

If PHP mysteriously decides that none of the standard PQ* functions exist, the reason is that the tests are defective. Specifically, in ext/pgsql/config.m4, LDFLAGS should be getting set to:

LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR -lpgport -lpam -lssl -lcrypto -lkrb5 -lz -lreadline -lm"

or something similar, as shown by the output of “pg_config”. Otherwise, links will fail for unrelated reasons.

This is true, anyway, using PostgreSQL8 for Mac, as shipped by Andy Satori. There were at least in the past similar issues with the Ruby “ruby_pg” extension. In general, people are not handling well the case where a library must have other libraries linked with it – this could be a flaw in how that library is configured. Whatever, that’s the fix that worked for me.