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:
- Launching
yum shell
- Telling it to erase PHP (note that it won't actually do that yet)
- Asking it to install the listed packages (again, this will just add them to the list)
- 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.
- 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.