php-mcrypt for PHP 5.4

I followed these instructions to install PHP 5.4 alongside 5.3.3 on CentOS 6.5

How do I install php-mcrypt for php 5.4? Symlinking the current mycrypt.ini and didn’t work (probably because php-mcrypt is php version dependent)

How do I install php-mcrypt for php 5.4?

I have EPEL and SCL repos installed.


I installed the remi repo ( It provides php-mcrypt version 5.4.31. It should work. But I don’t think it will know that the paths for php 54 (modules, ini, etc) is different from php 53, and it might overwrite mcrypt for php 53. Am I correct to assume this and if yes, is there a way around it?


Hi Eddie,

The following info fixed this issue for me:

Erik, thank you for the suggestion, but that thread deals with the PHP wrapper and handler. I have PHP 5.4 working fine - I just need to install php-mcrypt for it without overwriting the existing php-mycrypt (5.3.3) install.

For anybody who are trying this solution, the proper folders are:

for mcrypt.ini:


And here is the link for downloading:


Very easy to follow your additional instructions.

And thanks to eddieb too.

I used rpm2cpio to convert the only suitable .rpm file I found into a cpio archive on standard out.

$ rpm2cpio php-mcrypt-5.4.16-1.el6.x86_64.rpm | cpio -idmv

I then copied and mcrypt.ini to the proper folders for the PHP 5.4 install.

Voilá, mcrypt works now!