Slackware lacks postgresql support, so porting PHP webapps on a new server is a trouble. This article solved my problem in less then ten minutes.
In short
You need only the PHP pgsql.so module
Verify with pkgtool what's your PHP version, mine is 5.2.6 (Slackware 12.1)
Download in /usr/local/src the PHP sources, I take them from php.net website using this link
http://www.php.net/get/php-5.2.8.tar.bz2/from/a/mirror
replacing the version number
http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror
extract the compressed tarball, dive into the newly created directory and, as article say, type
./configure --with-pgsql=shared,/usr
then
make
Now copy the module in the corrected directory
cp modules/pgsql.so /usr/lib64/php/extensions/
open with an editor /etc/httpd/php.ini and add this line
extension=pgsql.so
approx at line 652
restart apache
/etc/rc.d/rc.httpd restart
done