Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
What exactly did not work and how did it fail? Could you provide a snippet of output? –  colechristensen Jan 30 '12 at 2:34
    
I updated my post with some of the stuff I've tried and the output. –  Buttle Butkus Jan 30 '12 at 2:42

5 Answers 5

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
share|improve this answer
    
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 3:07
    
Run the commands to install EPEL and your problems will be solved easily. –  colechristensen Jan 30 '12 at 3: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 3:10
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 3: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

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!)

share|improve this answer
    
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 3: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 6:48

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
share|improve this answer

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.

share|improve this answer
    
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 5:11

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.

share|improve this answer
    
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 3: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 3: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 3:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.