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

Ultimately, this question is about Yum and the Amazon Linux AMI (see the end for that part), but first I'll give some background to how I got into my situation.

I installed PHP from source

I am working on setting up a new PHP application on a web server that's hosted with Amazon Web Services. The EC2 instance is running "Amazon Linux AMI release 2012.09" (according to /etc/issue). I am not the primary admin for this server, so I'd like to limit the impact of the changes I make.

There are already some PHP applications running on this server. I need a newer version of PHP than they are using. They're using the version from the distro package which is 5.3, too old for my purposes.

I figured I'd download the PHP source, build it myself and run it alongside the other version. (How I'm going to set this up is a different matter that I won't get into here.)

I configured my PHP build with these options:

--prefix=/opt/php-5.5.9
--with-openssl
--with-mcrypt
--with-mysql
--with-pdo-mysql
--enable-fpm
--with-apxs2=/usr/sbin/apxs

Then, I switched to root and ran make install. (In retrospect, doing this as root was a mistake, I should have set user write permissions on the install directory and installed as my user so I could be sure none of the files were getting put outside the install directory. Too late for that now.)

I then noticed that the web server wasn't responding. After restarting it, it worked fine. I poked around a bit and noticed that for phpversion, the server now reports the new version that I just installed under /opt, not the distro version that I had intended to leave in place. It turns out that make install went ahead and replaced the existing libphp5.so. RPM reports:

[root@xxxx etc]# rpm -V php
S.5....T.    /usr/lib64/httpd/modules/libphp5.so

Everything still works just fine on the new version as far as I know, so most likely no harm was done. However, I'd rather leave the old version of PHP in place so the packages can still be managed by the package manager. This was my intent in putting the new version in /opt.

Trying to put the old version back, Yum failed

I attempted to restore the old version of libphp5.so with yum reinstall. Here's the output:

[root@xxxx etc]# yum reinstall php
Loaded plugins: fastestmirror, local, priorities, security, update-motd, upgrade-helper
Setting up Reinstall Process
Loading mirror speeds from cached hostfile
 * amzn-main: packages.us-east-1.amazonaws.com
 * amzn-updates: packages.us-east-1.amazonaws.com
amzn-main                                                               | 2.1 kB     00:00
amzn-updates                                                            | 2.3 kB     00:00
265 packages excluded due to repository priority protections
Installed package php-5.3.20-1.29.amzn1.x86_64 (from amzn-updates) not available.
Nothing to do

From this message, I'm not clear what the problem is. Is it failing to find the package on the update server? Is the server itself not available (hopefully temporarily)? Or is it excluding the package due to priority protections and thus refusing to reinstall it?

What is the best resolution for this problem that lets me restore the old version of PHP and put it back under the package manager's control?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Amazon replaced the PHP 5.3.20 package with a newer point release (for security fixes, etc.). Just update to it instead:

yum update php

And for Pete's sake, don't do this stuff in production! Start a new instance and do your experimentation there.

share|improve this answer
    
Thanks for your help! Believe me, this isn't my ideal scenario, I'd much rather have another instance or two but I don't pay the bills. –  Nate C-K Feb 18 at 3:00
1  
How much will it cost if the web site seriously breaks? Probably a lot more than a couple of hours of instance time. A couple of dollars? –  Michael Hampton Feb 18 at 3:12
    
You are entirely correct, of course. –  Nate C-K Feb 18 at 3:17

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.