Sometimes php complains about a missing mysql lib even if your mysql is perfectly installed, to solve this in slackware proceed this way:
Install the following packages:
libX11-1.3.3-x86_64-1.txz
libXau-1.0.5-x86_64-1.txz
libXdmcp-1.0.3-x86_64-1.txz
libXpm-3.5.8-x86_64-1.txz
tar xvfj php-5.x.x.tar.bz2
cd php-5.x.x
#Change the paths if you need
./configure –with-apxs2=/usr/local/etc/httpd/bin/apxs –with-config-file-path=/usr/local/etc/httpd/conf –with-mysql=/usr/local –with-openssl –enable-calendar –enable-ftp –with-mcrypt –enable-gd-native-ttf –with-jpeg-dir –with-gd=/usr/local –with-png-dir=/usr/local –with-zlib-dir=/usr/local –enable-mbstring –with-curl=/usr/local/bin/curl –enable-sockets –with-pdo-mysql=shared
make
make install
Done!