This is now done by stage 2 of the installer and has been completely automated for all CentOS, RedHat Enterprise and Ubuntu systems that need it.
If you happen to be trying to rebuild PHP on an old Ubuntu 12 (or earlier) system, here are some old instructions that should help you.