If you want the newly compiled php to fit perfectly into the existing RedHat installation the only reliably solution would be to use the latest source rpm package and to patch it.
You might also try the latest source rpm from
[url]ftp://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/[/url]
and try to rebuild it on RedHat 9 but I don't know if it works 🙁
Using another source rpm from somewhere will most probalby cause more problems than using one of the RedHat packages.