PHP mcrypt on CentOS 6

PHP on CentOS 6.6 didn’t have support for mcrypt_get_block_size() function. When something like that happen, next step is to use yum and try to install needed packages. Unfortunately, with default RPM repositories it was not possible and the solution was to add Remi and EPEL repositories.

Here is error message output from PHP page:

Fatal error: Call to undefined function mcrypt_get_block_size() ...

After search, I have found a good page on StackOverflow page with described problem, comments and solution:
http://stackoverflow.com/questions/17109818/install-php-mcrypt-on-centos-6

In short, it was needed to download Remi and EPEL (Extra Packages for Enterprise Linux) repositories – small RPM packages – and install them to the CentOS server:

[root@pandora ~]# cd /tmp
[root@pandora ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@pandora ~]# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[root@pandora ~]# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Now server should be ready to search and install php-mcrypt RPM package with the following command:

[root@pandora ~]# yum install php-mcrypt

… and the last step is to restart Apache httpd server (CentOS 6.6 is still SysVinit):

[root@pandora ~]# service httpd restart

Leave a Comment