You may get the below phpMyAdmin error for a couple different reasons which could be related to upgrading PHP or possibly on a new installation of phpMyAdmin. The issue can be resolved easily by installing or upgrading mcrypt on your server.
Error:Cannot load mcrypt extension. Please check your PHP configuration.
If you receive this error simply login to your server, which in this case was a 5.2 CentOS server, and install or upgrade mcrypt using the yum package manager. The package that needs to be installed for mcrypt to work properly with phpMyAdmin is php-mcrypt.
Install/Upgrade mcrypt:
- yum install mcrypt
Your issues should now be resolved and you will no longer see this error on the phpMyAdmin login screen. If you continue to have issue find out what version of php-mcrypt installed and compare that to the version of PHP.
Locate PHP Version: command with example output
- [root@dev ~]# php -v
- PHP 5.2.9 (cli) (built: Mar 10 2009 16:42:52)
- Copyright (c) 1997-2009 The PHP Group
- Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
- with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
Locate php-mcrypt Version: command with example output
- [root@dev ~]# rpm -qa | grep mcrypt
- libmcrypt-2.5.8-4.el5.centos
- php-mcrypt-5.2.9-2.el5.art
The versions need to match as shown above so if they do not match this should be the first place to start troubleshooting.
damn i hope this works :)
Hello NetsOne,
Me too. Let us know if it did work…
I have installed mcrypt by using below command
yum install mcrypt
But, still not work. Anything I need to restart or clean the memory ?
Hello Jimmy,
Do you also have php-mcrypt installed as well? Restart apache(or your web server) to reload the extensions loaded with PHP.
Thanks.
alex
Hi Alex,
I have also installed php-mcrypt by using below command
yum install php-mcrypt
When I run php -v , message return as below:
PHP 5.2.6 (cli) (built: Oct 2 2009 19:20:34)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
When I run rpm -qa | grep mcrypt , message return as below:
mcrypt-2.5.7-2.fc9.i386
php-mcrypt-5.2.5.7.fc9.i386
libmcrypt-2.5.8-5.fc9.i386
Anything missing ? Do I need to edit the php.ini ?
Thanks,
Jimmy
Hello Jimmy,
Where are you running into an error? If you post the error details and any other information regarding the error it may help someone resolve the issue.
Thanks.
alex
Thanks, good advice.
You’re correct, the mcrypt packages must be the same version as the installed PHP.
The best way to ensure this on RedHat is to get all your PHP and mcrypt packages via the same repository, at the same time. If you’ve got a mis-match, issue a ‘yum update’ command to get them to the same level.
If anyone cannot find the mcrypt packages via yum, just do a wildcard search:
[root@server]# yum list *mcrypt
Hello BG,
Thanks for more good advice. Not only is it smart to try to install the PHP and Mcrypt packages from the same repo but using the yum search as recommended is a great way to verify before installing.
Thanks again!
alex
well just had the same problems during setup a new centos server.
I used the remi repository and installed the components from there:
# yum –enablerepo=remi install php-mcrypt
# yum –enablerepo=remi install php-mbstring
it works fine now, great site, thank you
Hello Carsten,
No problem. Thanks for taking the time to share the commands you used. Are you using the remi repository for a different version of PHP or something? I have yet to hear of that repo so I would be curious on your feedback of why that repository is used. Thanks again for posting comments!
Thanks.
alex
well as you know CentOS comes with PHP 5.1 .x
To update PHP meanwhile to 5.3.2 I used the remi repository and simply had to follow the updates for mbcrypt and mbstring for the same version from there.
As I am more a MS user I am not that firm with installations, setups and configs on Linux. And so I am happy with those how-to-forums like this. That reduces setups to a minimum of researching
Again thanks to the entire community/ies
Hello Carsten,
Ahh great! That is what I was curious about for sure. I will check out the REMI repository for sure if I need to be running PHP 5.3.2 on a CentOS server which is definitely possible. I forget what repo I have used in the past but always willing to check out any other repos available. Thanks for taking the time to follow up.
Thanks.
alex
Works with Ubuntu 9.10 as well. GOODONYAH!
Hello Travis,
Great. We are glad to hear it and appreciate you taking the time to leave feedback.
Thanks.
alex
Well i have a problem: Cannot load mcrypt extension. Please check your PHP configuration.
i try to install on my RHEL but no packages are install, look like there’s no package.
Someone can give me a tip. Also there’s no package installed. (mcrypt).
Hello Erwin,
What specific command are you using in an attempt to install the mcrypt packages? When you attempt to install the package what error is received? What version of RHEL do you have installed and what repositories are installed on the server?
Thanks.
alex
Hi Alex thank for your reply
The command i used was: yum install mcrypt, yum install mcrypt* and yum install php-*
Don’t receive any error, just said: No packages available!! do nothing
My version is RHEL5. I have all php packages install. also on the php.ini i look for the extension and actually didn’t find that part.
Thank for your help.
Hello Erwin,
It sounds as if you have some other form of issue. If you issue “yum list *PHP-MCRYPT* does it show the package installed? What about “rpm -qa | grep mcrypt”.
Thanks.
alex
For the first command: Error: No matching package to list.
second: Didn’t show any result.
Also i logged to RHEL and look for the missing package and didn’t find it. Some possible missing file from RHEL???
Using: MySQL 5.0.77
Apache/2.2.3 (Red Hat)
PHP Version: 5.1.6
Ty for your reply
Hello Erwin,
You need to install the *Extras* repository which I believe includes the php-mcrypt package.
Thanks.
alex
Thanks for the reply Alex… I’ll have to make more investigation.
Ty
But still don’t know what extras :(
Thanks again ;)
Hello Erwin,
Please Google search “how to install Extras repository on CentOS Linux” which should provide the results you are looking for.
Thanks.
alex
When I start phpMyAdmin, i get the “Cannot load mcrypt extension. Please check your PHP configuration”. My configuration is as follows:
MySQL- 5.1.50, Apacahe: Apache/2.2.3
——
php -v
PHP 5.3.3 (cli) (built: Jul 22 2010 17:12:45)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
———-
rpm -qa | grep mcrypt
php-mcrypt-5.3.3-1.el5.remi
libmcrypt-2.5.7-5.el5
mcrypt-2.6.8-1.el5
——————————-
uname -a
Linux localhost 2.6.18-194.11.1.el5 #1 SMP Tue Jul 27 05:45:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
==================
help to get rid of the error would b nice.
Hello Ajay,
Are you loading the mcrypt module via php.ini? Should look something like the below…
; Enable mcrypt extension module
extension=mcrypt.so
Hope that helps.
Thanks.
alex
Hi Alex,
The issue was with IE cache. Once I cleared the IE cache, there was no error reported. I was also able to verify this from Chrome, Safari, from my and other machines. I did not have to include any entries in the php.ini file.
Appreciate your answer. Thanks.
Hello Ajay,
No problem at all. Thanks for following up and letting us know what it was. That information will definitely help others in the future.
Thanks.
alex
Linux 2.6.32-431.5.1.el6.x86_64
#Description:
#The php-recode package contains a dynamic shared object that will
#add support for using the mcrypt library to PHP.
yum install php-mcrypt