If you are unfamiliar with building and compiling your own software, it 's worth checking whether somebody has already built a packaged version of PHP with the features you need.
Compiling for OS X server