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:

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
[root@pandora ~]# wget
[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