How to install mcrypt on RHEL5

mcryptrhel5

We have an RHEL5 server that I'm trying to install PHP-Mcrypt on and I'm stuck when I tried to run ./configure for mcrypt source files.

I was using this guide: http://atlantatechpro.com/howtos/howtoslinux/howtosmhashmcrypt

When I try to install (./configure) mcrypt, I get this

checking for libmcrypt – version >= 2.5.0… no

Could not run libmcrypt test program, checking why…
The test program compiled, but did not run. This usually means
that the run-time linker is not finding LIBMCRYPT or finding the wrong
version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
to the installed location Also, make sure you have run ldconfig if that
is required on your system

If you have an old version installed, it is best to remove it, although
you may also be able to get things to work by modifying LD_LIBRARY_PATH

configure: error: *** libmcrypt was not found

I also made a file at /etc/ld.so.conf.d/libmcrypt.conf with /usr/local/libmcrypt in it and ran /sbin/ldconfig

I might have screwed things up by trying to reinstall libmcrypt without the configure arguments.

Any suggestions on what to do now?

Best Answer

Don't try to compile yourself, you'll just get yourself into trouble that way. (and even if you were compiling yourself, you should compile into RPMs and install those, instead of installing directly to the systems). First, try to find all the files you've installed yourself and remove them (check that they don't belong to a system package with rpm -qf /file.)

EPEL is the third-party source for RHEL packages that's closest to being "official", so I suggest that: http://fedoraproject.org/wiki/EPEL/FAQ#howtouse

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install php-mcrypt

(the exact RPM url changes with time as updates happen and is different for different RHEL versions, so check the EPEL FAQ to get the correct link.)

The first step sets you up with EPEL, the second installs PHP Mcrypt and all its dependencies.