Php – Can’t Install mcrypt for CentOS 7 Using php-common-5.4.16

centos7PHPphp-mcrypt

I've tried installing mcrypt and I'm receiving an error (below). Basically the error says I have the wrong version of PHP (as far as I can tell). I've seen a similar post here:

Can't install php-mysql module

But I'm not clear on how (if possible) to re-mediate this issue and get mcrypt installed.

I've checked a number of sources for how to install php-mcrypt; an example would be:

https://stackoverflow.com/questions/25919595/how-to-install-mcrypt-php-extension-on-centos-7-0-x64

The error I am getting:

[root@blogs-etal-1 steinholland.com]# sudo yum -y install php-mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.nac.net
 * epel: mirrors.mit.edu
 * extras: mirror.cc.columbia.edu
 * remi-safe: remi.mirrors.cu.be
 * updates: linux.cc.lehigh.edu
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.x86_64 0:5.3.3-4.el6 will be installed
--> Processing Dependency: php(zend-abi) = 20090626 for package: php-mcrypt-5.3.3-4.el6.x86_64
--> Processing Dependency: php(api) = 20090626 for package: php-mcrypt-5.3.3-4.el6.x86_64
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.3.3-4.el6.x86_64
--> Running transaction check
---> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
---> Package php-mcrypt.x86_64 0:5.3.3-4.el6 will be installed
--> Processing Dependency: php(zend-abi) = 20090626 for package: php-mcrypt-5.3.3-4.el6.x86_64
--> Processing Dependency: php(api) = 20090626 for package: php-mcrypt-5.3.3-4.el6.x86_64
--> Finished Dependency Resolution
Error: Package: php-mcrypt-5.3.3-4.el6.x86_64 (epel)
           Requires: php(api) = 20090626
           Installed: php-common-5.4.16-23.el7_0.3.x86_64 (@base)
               php(api) = 20100412-64
           Available: php-common-5.4.16-36.el7_1.x86_64 (base)
               php(api) = 20100412-64
Error: Package: php-mcrypt-5.3.3-4.el6.x86_64 (epel)
           Requires: php(zend-abi) = 20090626
           Installed: php-common-5.4.16-23.el7_0.3.x86_64 (@base)
               php(zend-abi) = 20100525-64
           Available: php-common-5.4.16-36.el7_1.x86_64 (base)
               php(zend-abi) = 20100525-64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Best Answer

You're running CentOS 7, but you installed EPEL for CentOS 6. This obviously is not going to work. Remove it and reinstall EPEL for CentOS 7.

yum reinstall epel-release