Installing mcrypt for PHP 5.3 on CentOS 5.6
October 23rd, 2011
With CentOS 5.6 Red Hat added an optional php53 package for those that need a PHP version later than 5.1.6. After removing the php packages and installing php53 you will probably notice that the mcrypt extension is missing. With a few steps we can compile and install this extension.
yum install php53-devel libmcrypt-devel gcc
cd
wget http://vault.centos.org/5.6/updates/SRPMS/php53-5.3.3-1.el5_6.1.src.rpm
mkdir /usr/src/redhat
rpm -i php53-5.3.3-1.el5_6.1.src.rpm
cd /usr/src/redhat/SOURCES
bunzip2 php-5.3.3.tar.bz2
tar xf php-5.3.3.tar
cd php-5.3.3/ext/mcrypt
phpize
aclocal
./configure
make
make install
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
service httpd restart