$ wget http://www.php.net/get/php-5.3.15.tar.bz2/from/a/mirror $ tar -xvzf php-5.3.15.tar.gz $ cd php-5.3.15/ext/mcrypt
$ phpize
$ ./configure
$ make
$ make test
$ sudo make install
mcrypt.so is now in your PHP ext dir (/usr/lib/php/extensions/no-debug-non-zts-20090626/ in my case), now you need to add to php.ini as a module
$ vi /etc/php.ini
$ (insert) extension=mcrypt.so
$ sudo apachectl restart
If need to install libmcrypt, please follow below steps:
1. Get libmcrypt 2.5.8 from Sourceforge, this is direct download link.
2. tar -zxvf libmcrypt-2.5.8.tar.gz
3. cd libmcrypt-2.5.8
4. ./configure
5. make
6. make install