Hi,
We have "easyapache" tool to compile apache and php in cpanel servers. In case if you are curious to recompile your php manually in a cpanel server, You can follow the steps.(Well, I followed these)
1, cd /home/cpeasyapache/src/php-*
2,
./configure' '--disable-fileinfo' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' '--enable-magic-quotes' '--enable-sockets' '--prefix=/usr' '--with-curl=/opt/curlssl/' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pic' '--with-zlib' '--with-zlib-dir=/usr
Note : You can fetch the configure options from any phpinfo page from the server or it is available from the following command also
php -i | grep configure
3. make && make install
4, service httpd restart
This has worked for me.