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.

Buttle Butkus
  • 1,741
  • 8
  • 33
  • 45

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
colechristensen
  • 602
  • 1
  • 5
  • 14
  • No, php 5.3 is not really necessary. But php 5.2+ is. Either way, I can't use the default PHP used in CentOS 5.7. If installing 5.2 with all the packages I need is significantly easier, I would certainly do it. But since it is not the default either, I assume it may be just as hard and therefore I may as well put in the effort for 5.3 as for 5.2. ?? – Buttle Butkus Jan 30 '12 at 03:07
  • Run the commands to install EPEL and your problems will be solved easily. – colechristensen Jan 30 '12 at 03:10
  • Also, if it wouldn't be too much trouble could you please explain how you found the package and ensured it was the correct one for the OS version, processor (32/64 bit), and PHP version? I.e. what tool did you use to find the rpm url that gave you the exact package you needed? Thanks a lot! – Buttle Butkus Jan 30 '12 at 03:10
  • Oh, and one more quick thing: is "yum install" really supposed to appear twice in a row? – Buttle Butkus Jan 30 '12 at 03:12
  • Fixed the double yum install. EPEL is popular http://fedoraproject.org/wiki/EPEL I've known about it for years. It was the first place I checked for a missing package such as this. There are others such as RPMFusion, but beyond that it becomes unreasonable to find random RPMs on the web to try to install. EPEL is heavily tested and certain to work. – colechristensen Jan 30 '12 at 03:15
  • 1
    So, yum install php53-mcrypt worked, but very sadly php53-mhash and php53-pear were not found. Does this mean they don't exist on EPEL? – Buttle Butkus Jan 30 '12 at 03:23
  • 1
    This answer worked for me. Don't forget to restart, `/etc/init.d/httpd restart`, to view the changes. – Josh Apr 20 '12 at 17:57
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
夏期劇場
  • 455
  • 2
  • 6
  • 19
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
  • 244,070
  • 43
  • 506
  • 972
  • I ended up solving my problem and, though it was months ago, I *believe* it was using the remi repository. I also remember running into a few glitches though. I had to uninstall/reinstall several times before everything went right. – Buttle Butkus Jul 19 '12 at 03:46
  • Remi has become right behind EPEL in the repositories I add to a freshly installed CentOS box. It saves a lot of headaches later. :) – Michael Hampton Jul 19 '12 at 06:48
-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
  • 244,070
  • 43
  • 506
  • 972
Maulik Shah
  • 101
  • 1
  • Better install the EPEL repositories properly so any dependencies get resolved properly. Do _not_ go hunting for random packages over the net! – vonbrand Mar 13 '13 at 11:10
  • yep @vonbrand ,you are right i tried it,but didn't find one,so used above solution to solve the issue quickly – Maulik Shah Mar 14 '13 at 05:11
-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
  • 24,916
  • 3
  • 51
  • 70
  • Manually managing packages like this when the real problem you are working on is completely different... is usually a mistake. You won't know about security updates, bugfixes, and have a solid chance of screwing things up and wasting your time fixing the wrong problems. That, and EPEL, a repository affiliated with RedHat, publishes a php53-mcrypt package for EL5 based distributions. – colechristensen Jan 30 '12 at 03:03
  • I'm quite aware of the issues. The problem is that, from the original poster's earlier questions, he's in a bind in trying to get php 5.3 running on a CentOS5 instance. From the blog post I cited, he's going to be screwed anyway, as there are no php53-mcrypt and php53-pear packages, so no matter what he does he'll be out of version control. If he has to be on a CentOS5 box, he doesn't have much of a choice if he requires php mcrypt and pear. – cjc Jan 30 '12 at 03:13
  • Actually, php53-mcrypt did get installed when I followed colechristensen's post. But php53-pear and php53-mhash failed. I don't want to mess with compiling, so I think better options are 1: try to do all this again with php52 (I need at least php 5.2). And if that fails, I would try upgrading CentOS to 5.7. And if that fails, buy a new server and install a workable OS myself. – Buttle Butkus Jan 30 '12 at 03:27