PHPLover PHPLover - 1 year ago 69
Linux Question

How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS?

I'm using Ubuntu Linux 12.04 LTS on my local machine. I've installed LAMP long ago on my machine. Now I want to enable following PHP extensions:

  1. php_zip

  2. php_xml

  3. php_gd2

For it first I want to check whether these PHP extensions are enabled or not. I searched a lot about how to check the installed/enabled PHP extensions but every time I found how to install these extensions on Ubuntu Linux. So can someone please let me know how should I check the enabled/disabled PHP extensions in Ubuntu Linux 12.04 LTS? Thanks in advance.

Answer Source

In addition to running

php -m

to get the list of installed php modules, you will probably find it helpful to get the list of the currently installed php5 packages in Ubuntu:

dpkg --get-selections | grep -v deinstall | grep php

This is helpful since Ubuntu makes php modules available via packages. Then you can search and install the needed modules by selecting from the available Ubuntu php packages, which you can view by running:

apt-cache search php | grep "^php5-"

As you have mentioned, there is plenty of information available on the actual installation of the packages that you might require, so I won't go into detail about that here.