Considering that you have an existing php installation compiled from sources, it is very easy to add afterwards new php modules, outside the php binary. This can be achieved without any interruption of the web services, and requires just the following steps:
1. Ensure you have the mcrypt libraries and development tools.
For example on a rhel system you will have to install: libmcrypt and libmcrypt-devel. If you can’t find those on your repos, dag has rpms for all rhel releases.
2. Compile the mcrypt module:
Assuming you have your php sources inside /usr/local/php, you have to:
just as on any 3rd party php module.
3. Finally activate the module in your php.ini
by adding the line:
you will also want to restart your apache service in order to see the new php module installed.