well you have the entire build environment on your router ready so it's going to be easy.
First you need to download the sourcecode from
http://php.net/ be sure to download the
same version as you have installed
also you
need to rebuild the extension after an php update from ipkg repository
anyway the internet is full of how-to's and this one seems to be helpfull:
http://mattiasgeniar.be/2008/09/14/h...s-from-source/
you can skip #1 here since you have that already
#2 is just for unzipping the source on your router
then the rest is pretty straight forward, just like the stuff we did with eaccelerator:)