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:
- php_zip
- php_xml
- 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.
Search extension in
Perhaps the easiest way to see which extensions are (compiled and) loaded (not in cli) is to have a server run the following:
PHP cli does not necessarily have the same extensions loaded.
For information on
php extensions
etc, on site.Create a new file and name it
info.php
(or some othername.php
)Write this code in it:
Save the file in the
root
(home)of the siteexample.com/info.php
All thephp
information on your site will be displayed.You can view which modules (compiled in) are available via terminal through
php -m
Checking for installed php modules and packages
In addition to running
to get the list of installed php modules, you will probably find it helpful to get the list of the currently installed php packages in Ubuntu:
This is helpful since Ubuntu makes php modules available via packages.
You can then install the needed modules by selecting from the available Ubuntu php packages, which you can view by running:
Or, for Ubuntu 16.04 and higher:
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.
Related: Enabling / disabling installed php modules
It is possible that an installed module has been disabled. In that case, it won't show up when running
php -m
, but it will show up in the list of installed Ubuntu packages.Modules can be enabled/disabled via the
php5enmod
tool (phpenmod
on later distros) which is part of thephp-common
package.Ubuntu 12.04:
Enabled modules are symlinked in
/etc/php5/conf.d
Ubuntu 12.04: (with PHP 5.4+)
To enable an installed module:
To disable an installed module:
Ubuntu 16.04 (php7) and higher:
To enable an installed module:
To disable an installed module:
Reload Apache
Remember to reload Apache2 after enabling/disabling:
To check if this extensions are enabled or not, you can create a php file i.e.
info.php
and write the following code there:That's it.