PEAR makes it easy to create shared PHP extensions. Using the pear command, do the following:
$ pear install extname
That will download the source for extname, and compile it on the system. This results in an extname.so file that may then be included in php.ini
In case the systems preferred_state is set higher than an available extname version, like it's set to stable and the extension is still in beta, either alter the preferred_state via pear config-set or specify a specific version of the PECL extension. For example:
$ pear install extname-0.1.1
Regardless, pear will copy this extname.so into the extensions directory. Adjust php.ini accordingly.