How to compile php on centos with GD and mysql

assum mysql installed in directory /usr/local/mysql

Install requested libraries for GD

1. zlib, available from http://www.gzip.org/zlib/
Data compression library

2. libpng, available from http://www.libpng.org/pub/png/
Portable Network Graphics library; requires zlib

3. FreeType 2.x, available from http://www.freetype.org/
Free, high-quality, and portable font engine

4. JPEG library, available from http://www.ijg.org/
Portable JPEG compression/decompression library
download gd-2.0.35.tar.bz2 from http://www.libgd.org/releases/ and unzip it.

cd gd-2.0.35 ...