Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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/ 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/ 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?

share|improve this question
up vote 6 down vote accepted

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:

rpm -Uvh
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.

share|improve this answer
Thanks, I'll try that tomorrow. Is there an easy way to find out and remove all the files that I already tied to install? – wag2639 Mar 22 '10 at 4:16
No, there really isn't any reliable, easy, generic way. Which is a big reason to go with RPM instead of direct compile+install. It sounds like you installed everything into /usr/local, so it shouldn't be too hard... – freiheit Mar 22 '10 at 13:24
make uninstall is supported in a lot of Makefiles these days. Otherwise, you just remove all the files installed from the output of make install. – Warner Mar 22 '10 at 13:59
For people viewing this from Jan 2012 onwards, this URL should (hopefully) work:… – hohner Jan 28 '12 at 22:08
@Jamie: The question was about RHEL5, not RHEL6. Just now I updated the example URL and made it clearer that somebody should really check that EPEL FAQ to get the right URL. – freiheit Jan 28 '12 at 22:15


install DAG rpm and then

yum install mhash yum install mcrypt yum install php-mhash yum install php-mcrypt

it working for me!!! RHEL 5.4 i'm using

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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