We had to do a re-compilation of our PHP installation earlier today, to add in a few extensions. After a lot of Google-ing, we didn’t find anything about this, but someone helped us out(thanks, Sunil!).
So, if you need to re-compile your existing PHP installation, and retain your earlier extensions/settings, do the following:
find the config.nice file on your system
edit it to add in the extensions you need to add (eg. '--with-curl' \)
run make and then do a make install
That’s it. You’re good to go.