Dependency fail on php-api when installing php-mcrypt or php-mhash from EPEL on CentOS 6

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, June 06, 2012

Follow me on Twitter as @mattiasgeniar

You may get a dependency error on php-api like the following error when you try to install the packages php-mcrypt or php-mhash from the EPEL repository.

# yum install php-mcrypt
...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-mcrypt.x86_64 0:5.1.6-5.el5 will be installed
--> Processing Dependency: php-api = 20041225 for package: php-mcrypt-5.1.6-5.el5.x86_64
--> Finished Dependency Resolution
Error: Package: php-mcrypt-5.1.6-5.el5.x86_64 (epel)
           Requires: php-api = 20041225
           Installed: php-common-5.3.3-3.el6_2.8.x86_64 (@updates)
               php-api = 20090626
           Available: php-common-5.3.3-3.el6_1.3.x86_64 (base)
               php-api = 20090626
           Available: php-common-5.3.3-3.el6_2.5.x86_64 (updates)
               php-api = 20090626
           Available: php-common-5.3.3-3.el6_2.6.x86_64 (updates)
               php-api = 20090626
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

The php-api dependency only existed on CentOS 5 and does not exist on CentOS 6. Chances are, you added the EPEL release package for CentOS 5 on your system instead of the one for CentOS 6.

# rpm -qa | grep epel-release
epel-release-5-4.noarch

Remove it and install the proper package for CentOS 6.

# yum remove epel-release
# rpm -ivh "http://be.mirror.eurid.eu/epel/6/i386/epel-release-6-7.noarch.rpm"
# yum clean all
# yum install php-mcrypt


Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.