Using yum
List and remove the indicated packages and all their dependencies, but with a y/N
confirmation:
yum remove 'php*'
To bypass the confirmation, replace yum
with yum -y
.
Using rpm
This section builds upon the answers by twalburg and Ricardo.
List which RPMs are installed:
rpm -qa 'php*'
rpm -qa | grep '^php' # Alternative listing.
List which RPMs which will be erased, without actually erasing them:
rpm -e --test -vv $(rpm -qa 'php*') 2>&1 | grep '^D: erase:'
On Amazon Linux, you may need to use grep '^D: ========== ---'
instead.
If the relevant RPMs are not listed by the command above, investigate errors:
rpm -e --test -vv $(rpm -qa 'php*')
Erase these RPMs:
rpm -e $(rpm -qa 'php*')
Confirm the erasure:
rpm -qa 'php*'
grep
command doesn't pick up anything on my Amazon Linux instance, I think it should be looking for'^D: ========== ---'
instead. Also (because this is non-obvious), in the case of multiple wildcards (e.g., LibreOffice), the query command would look likerpm -qa 'libreoffice*' 'libobasis*'
. – Container