11

I installed php 5.3 and some modules using

yum install php53-{module-name}

But mcrypt did not work.

I searched like this:

yum list php* | grep mcry

The only package that came up was

php-mcrypt.x86-64         5.1.6-15.e15.centos.1    extras

I have the same exact problem with mhash. The results for php are even more confusing.

I know this is probably a dumb question, but any help would be appreciated. I am used to Ubuntu's simple "apt-get install" and everything works. CentOS seems to be a lot more detail oriented.

Thanks.

EDIT: Here's what I tried:

yum install php53-mcrypt

Result:

No package php53-mcrypt available

And trying this:

yum install php-mcrypt

Results in:

Error: php53-common conflicts with php-common

Because php-mcrypt tries to get php-common as a dependency (?) and I am trying to use php 5.3 rather than the default php 5.1 on CentOS 5.7.

5 Answers5

18

Is php 5.3 really necessary for what you're doing? Don't automatically assume newer is better.

If you upgrade to CentOS 6 php 5.3 is the default.

What you have to understand is RedHat (and thus its clones) is very conservative about upgrading packages with good reason. If you want the to push it and get more upgraded packages, expect problems.

That said, the package you are looking for exists! All you need to do is

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install php53-mcrypt

The EPEL repo contains more, and more upgraded packages to compliment the default repository.


Install EPEL Repository On 32-bit CentOS Linux 5.5:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install EPEL Repository On 64-bit CentOS Linux 5.5:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
2

This will definitely work on CentOS/RHEL 6+ Versions.
Hope similar approach will work on 5+ versions.

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update
yum install -y php-mcrypt
1

Since people are still coming here, I'm going to throw in an answer I haven't seen yet.

I run CentOS but I also need to keep current with PHP and MySQL, with later versions than Red Hat chooses to provide. To solve this problem, I use the remi repository, which provides current packages of PHP, MySQL, Symfony and a few other things for CentOS.

(And I just decommissioned the last CentOS 5 box less than an hour ago, hooray!)

Michael Hampton
  • 252,907
-1

Initially, find out what version of PHP you are using:

rpm -q php
output:php-5.3.3-22.el6.x86_64

Find the appropriate RPM package on http://rpmfind.net/linux/rpm2html/search.php?query=php-mcrypt (match your PHP version and CPU architecture)

For me it was ftp://rpmfind.net/linux/epel/6/x86_64/php-mcrypt-5.3.3-1.el6.x86_64.rpm

This completes the installation:

wget -c ftp://rpmfind.net/linux/epel/6/x86_64/php-mcrypt-5.3.3-1.el6.x86_64.rpm
rpm -i --nodeps php-mcrypt-5.3.3-1.el6.x86_64.rpm

Check php -v for errors.

Michael Hampton
  • 252,907
-2

Looks like you'll have to compile it yourself, as there doesn't seem to be an mcrypt RPM for php-5.3 on CentOS5.

Take a look at this on how to do the compile:

http://chrisjean.com/2011/06/24/upgrade-php-5-1-or-5-2-to-5-3-on-centos/

Note that this will take you out of package management for mcrypt and pear, if that's important.

cjc
  • 25,492