0

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.

Jim B
  • 24,081
  • 4
  • 36
  • 60
Ursula
  • 176
  • 1
  • 7

4 Answers4

1

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.

BMDan
  • 7,249
  • 2
  • 23
  • 34
0

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.

BMDan
  • 7,249
  • 2
  • 23
  • 34
Ursula
  • 176
  • 1
  • 7
0

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.

0

What I normally do in centOS 6.x for upgrading default php from 5.x to ius php53u is:

rpm -Uhv https://centos6.iuscommunity.org/ius-release.rpm
yum -y install yum-utils yum-plugin-replace
yum -y install libtidy
yum -y --enablerepo=ius-archive replace php --replace-with php53u
yum -y --enablerepo=ius-archive install php53u php53u-common php53u-imap php53u-bcmath php53u-gd php53u-dba php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap php53u-xml php53u-tidy
php -v