I used RedHat for years, and compiling new versions of PHP was really
easy because phpinfo() displayed ./configure options stored by php build
my next tip: on the commandline you can use
php -i
to print the ./configure options with which this current version was built. ./configure options are printed in the very first lines.