Debian / Ubuntu Linux list installed PHP packages on the system

Fig.01: Debian Linux list installed PHP packages on the system

Fig.01: Debian Linux list installed PHP packages on the system

You can list installed PHP packages on the system using the following apt-get command on Debian or Ubuntu Linux server:
$ dpkg --list | grep php | awk '/^ii/{ print $2}'
Sample outputs:

libapache2-mod-php5
php-pear
php5
php5-cgi
php5-cli
php5-common
php5-fpm
php5-gd
php5-json
php5-mysql
php5-readline

You can store names in a shell variable:
$ list="$(dpkg --list | grep php | awk '/^ii/{ print $2}')
$ echo "$list"

Examples and usage: How to install PHP 7 on Debian Linux 8.7/7.x [jessie/wheezy]