This will probably solve your problem. Let us know if it doesn't. Taken from the documentation:
If you are running PG 7, make a symbolic link from libpq.so.2.0 pointing to libpq.so.2.1 because AOLserver looks for libpq.so.2.0 when
loading the driver:
cd /usr/local/pgsql/lib
ln -s libpq.so.2.1 libpq.so.2.0 (as user postgres)