I have two parallel versions of PHP installed on CentOS 6.5 via this method

[root@host ~]# php -i | grep "PHP Version"
PHP Version => 5.3.3
[root@host ~]# /opt/rh/php54/root/usr/bin/php -i | grep "PHP Version"
PHP Version => 5.4.16

The installs came from

[root@host ~]# rpm -q php php-mcrypt
[root@host ~]# rpm -q php54 php54-mcrypt
package php54-mcrypt is not installed
[root@host ~]# rpm -q libmcrypt
[root@host ~]# rpm -q libmcrypt-devel

On sites running PHP 5.3.3, mcrypt works fine. I need to make mcrypt available to the sites running 5.4.16. Naturally I tried yum install php54-mcrypt, but that returns No package php54-mcrypt available.. The following repos are enabled:


So I searched for an RPM, and found this one. But if I try to install this RPM, it tries to update the currrent PHP mcrypt, which I need to keep running for sites on 5.3.3. I'm under the impression that php-mcrypt needs to be an exact to the php version and it's not backwards compatible.

I need to install mcrypt for PHP 5.4.16, where PHPZTS="" and PHPAPI=20100525. How can I do this?


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 mcrypt.so an mcrypt.ini to the proper folders for the PHP 5.4 install.

Voilá, mcrypt works now!

| improve this answer | |
  • This worked for me, the problem afterwards is glibc-2.14 was required and although I tried setting LD_LIBRARY_PATH in /etc/sysconfig/httpd and /etc/rc.d/init.d/httpd, it seems Apache 2.2 hung, so I gave up with php54 in my system. – Jose Manuel Gomez Alvarez Oct 30 '16 at 1:24

Unfortunately, the CentOS SCL collection for php54 does not include php54-mcrypt.

You can take the SRPM for the php-mcrypt-5.4 and modify the spec to change the package name, install location, etc. In other others, create your own package (check rpmbuild).

Or you could also use rcollet's repository as an alternative.

| improve this answer | |
  • Thanks @gtirloni, but I found a more practical solution. – Gaia Aug 19 '14 at 11:26
  • 1
    Glad it worked! Just remember to keep it updated, as it sits outside your package management system now. – Giovanni Tirloni Aug 19 '14 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.