There is a minor bug in the php source code that causes compilation to fail against postgresql 7.1.
The fix is easy, and is referenced here:
<!-- m --><a class="postlink" href="http://www.php.net/bugs.php?id=10406">http://www.php.net/bugs.php?id=10406</a><!-- m -->
Basically, you need to change the include from pointing to postgres.h to postgres_fe.h in the ext/pgsql/php_pgsql.h in the php source directory.
The fix is easy, and is referenced here:
<!-- m --><a class="postlink" href="http://www.php.net/bugs.php?id=10406">http://www.php.net/bugs.php?id=10406</a><!-- m -->
Basically, you need to change the include from pointing to postgres.h to postgres_fe.h in the ext/pgsql/php_pgsql.h in the php source directory.