2

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
php-5.3.3-27.el6_5.1.x86_64
php-mcrypt-5.3.3-3.el6.x86_64
[root@host ~]# rpm -q php54 php54-mcrypt
php54-1-7.el6.centos.alt.x86_64
package php54-mcrypt is not installed
[root@host ~]# rpm -q libmcrypt
libmcrypt-2.5.8-4.el6.art.x86_64
[root@host ~]# rpm -q libmcrypt-devel
libmcrypt-devel-2.5.8-4.el6.art.x86_64

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:

asl-4.0 
base 
epel 
extras 
scl 
updates 
virtualmin 
virtualmin-universal

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?

2 Answers 2

2

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!

1
  • 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. Oct 30, 2016 at 1:24
1

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .