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.

I want to upgrade my CentOS 6.4 server from php53 (epel repository) to php53u (ius repository). I already enabled the ius repository, but am hesitant to just play around because there are production web-sites on the server.

(Because the production sites are in Drupal 7, I want to stay on the 5.3 track, but I also want to install a Drupal 8 development site, which requires 5.3.10 minimum - epel only gives me 5.3.3)

Can anybody give me a hint on what would be the safest approach:

  1. remove php53 (epel) and install php53u
  2. just install php53u and see what happens
  3. your other recommendation

A couple of minutes downtime are acceptable, but not more.

share|improve this question
3  
Why not try it on a staging server? –  Ignacio Vazquez-Abrams Jul 23 '13 at 23:09
    
Good idea - I don't have a staging server that runs the same OS. –  Ursula Jul 23 '13 at 23:15
    
VMWare, Xen, KVM, virtualbox ... you don't need hardware to make one. If you don't test changes before making them on your production server, expect it to break. –  yoonix Jul 23 '13 at 23:21
    
Working on it now ... –  Ursula Jul 23 '13 at 23:23
    
You can't replace it, first of all you need to erase php-5.3.3 and then install php-53u from ius. Don't forget to install mysqlclient16 –  ALex_hha Jul 24 '13 at 5:46

3 Answers 3

up vote 0 down vote accepted

Ok, this is what I did, what worked and what didn't:

Three scenarios:

  1. just install php53u and see what happens replaces php but complains about dependencies

  2. remove php and install php53u

    That's the one that worked like a charm:

    yum erase php

    yum install php53u php53u-common php53u-xml php53u-devel php53u-mysql php53u-pecl php53u-gd

  3. The commenters' recommendation was, to test this on a testing server first (thanks for urging me!). I tested it on a CentOS 5.9 server that runs a Drupal 7 development site (and a whole bunch of non-php related stuff). That server runs a mysql 5.6 server, which required installing the php53u-mysql rpm manually using --nodeps to get it to work - just adding this here for completeness.

In the end, there was no downtime, just a graceful reloading of httpd.

share|improve this answer

I am assuming that your commands should be on two separate lines. I edited it to reflect that.

The problem here is that "yum erase php" is also going to pull dependencies out. This means that you'll lose any packages you installed that depend on PHP. There exists a yum command called replace. but it is not always present and sometimes... surprises. And not in a good way.

Thus, I prefer to break out yum shell. The commands to complete your operation would look like:

yum shell
erase php
install php53u php53u-common php53u-xml php53u-devel php53u-mysql php53u-pecl php53u-gd
ts
run

In order, we are:

  1. Launching yum shell
  2. Telling it to erase PHP (note that it won't actually do that yet)
  3. Asking it to install the listed packages (again, this will just add them to the list)
  4. Requesting "transaction-show"; that is, asking yum to tell us what it's about to do. Just a sanity check, really, as we'll see this again in the next step.
  5. Telling yum to run the transaction as listed. It will check dependencies and produce the full list of actions it intends to take, and present you with a traditional yum y/n prompt for approval before continuing.

In order to make sure I really get everything, I've been known to write up a quick bit of bash. Something like:

rpm -qa --queryformat '%{NAME}-%{VERSION}.%{ARCH}\n' | grep -E '^php53[^u].*5\.3' | tr '\n' ' '
rpm -qa --queryformat '%{NAME}-%{VERSION}.%{ARCH}\n' | grep -E '^php53[^u].*5\.3' | sed 's/php53/php53u/;s/-5\.3\..*//'

The first line gives me the list of packages that I put after erase inside of yum shell. The second line gives me the list of packages to put after install. Note that you may have to handle some ancillary packages (e.g. ones from PECL) manually. Use some variant on rpm -qa | grep php | grep -vE '^php53.*5\.3' to track those down. They should be rare, though.

share|improve this answer

My problem revolved around the "php53-common conflicts with php-common" issue. The box is an old server and I was going to test some code before putting it on the production machine. It's running Centos 5 and used to be production but is now relegated to testing. It's too old to upgrade to Centos 6x without new guts so I'm stuck with it for now.

So... practically nothing worked until I stumbled upon this idea on the web:

Install epel and ius repositories. Remove all php packages Install all php53u packages as reflected in the above answer.

I did not use "yum erase" at all.

share|improve this answer

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.