1

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
slm
  • 7,615
  • 16
  • 56
  • 76
ddjammin
  • 33
  • 1
  • 5
  • 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

2 Answers2

0

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.

dmourati
  • 25,540
  • 2
  • 42
  • 72
0

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 - http://www.atomicorp.com/installers/atomic | /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 php-pdo-5.2.17-1.el6.art.x86_64 php-pecl-memcached-5.2.17-1.el6.art.x86_64 php-xml-5.2.17-1.el6.art.x86_64 php-pecl-memcache-5.2.17-1.el6.art.x86_64 php-5.2.17-1.el6.art.x86_64 php-pear-5.2.17-1.el6.art.x86_64 php-mcrypt-5.2.17-1.el6.art.x86_64 php-xmlrpc-5.2.17-1.el6.art.x86_64 php-snmp-5.2.17-1.el6.art.x86_64 php-odbc-5.2.17-1.el6.art.x86_64 php-ldap-5.2.17-1.el6.art.x86_64 php-common-5.2.17-1.el6.art.x86_64 php-mysql-5.2.17-1.el6.art.x86_64 php-gd-5.2.17-1.el6.art.x86_64 php-mbstring-5.2.17-1.el6.art.x86_64 php-cli-5.2.17-1.el6.art.x86_64 php-devel-5.2.17-1.el6.art.x86_64 php-pecl-zip-5.2.17-1.el6.art.x86_64 php-imap-5.2.17-1.el6.art.x86_64 php-ncurses-5.2.17-1.el6.art.x86_64 php-mhash-5.2.17-1.el6.art.x86_64

This got me what I needed.

ddjammin
  • 33
  • 1
  • 5