List installed PHP packages on Ubuntu and Debian

If you have ever found yourself wondering what PHP packages are installed on a Debian or Ubuntu server you can run the following from the command line.

dpkg –get-selections

[email protected]:~$ dpkg –get-selections | grep php
libapache2-mod-php5 install
php-pear install
php5-cli install
php5-common install
php5-curl install
php5-dev install
php5-gd install
php5-mcrypt install
php5-memcached install
php5-mysql install
php5-xdebug install
phpmyadmin install

In my example I am piping the output through grep to only show packages with PHP in their names.

If PEAR is installed you can get a list of packages installed with the following command:

pear list

[email protected]:~$ pear list
Installed packages, channel
Package Version State
Archive_Tar 1.3.7 stable
Console_Getopt 1.3.0 stable
PEAR 1.9.4 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable


  Comments: 1

  1. Thank you. I use your instruction to clone my vps 🙂

Your feedback