Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to downgrade php on a server and found the command below. Something seems to be wrong with the syntax.

yum downgrade $(rpm -qa --qf "%{NAME} " | \
            grep -v ioncube | grep ^php | awk '{print $1"-5.2.17"}')

I get the following error message:

Error: Need to pass a list of pkgs to downgrade
usage: yum [options] COMMAND
share|improve this question
This generate error because rpm output is just single long line (you replace standard \n in output with just " "), so next grep ^php produce empty output - if you use just rpm -qa then this method will work too. – dsznajder May 10 '13 at 20:42

I think you are making the command line far too complicated:

sudo yum downgrade php-*

I don't think that is going to get you what you want though.

share|improve this answer
Thanks for your response. This actually led me to what I ended up doing. – ddjammin May 10 '13 at 18:06
up vote 0 down vote accepted

My situation might a little specific but here is what worked for me. I am sure there is a better way but....

I added the atomic repo. wget -qq -O - | /bin/bash

Sent all the installed programs to a file. rpm -qa --qf "%{NAME} "> installed

Filtered the results to a new file with just the apps that I needed. The grep -v command did not work as I thought it would. I needed to exclude the phpioncube and I thought the -v would do it but it still showed up the file. I manually deleted it. grep -v ioncube installed |grep php installed>phpapps

I knew the specific version that I wanted to downgrade to so I appended it to each package name and ran the following command. yum downgrade install

This got me what I needed.

share|improve this answer

Your Answer


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.