I know PHP 5.2 is obsolete and probably insecure, this is for restricted internal use only
./configure --with-apxs2=/usr/local/apache24/bin/apxs \ --with-mysql=/usr --with-mysql=/usr/bin/ --with-libdir=lib64 --prefix=/usr/local/php52
Assistance from here