[php] 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.

This question is related to php linux ubuntu-12.04 php-extension

The answer is


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:

<?php 
echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
echo "XML: ", extension_loaded('xml') ? 'OK' : 'MISSING', '<br>';
echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';
?>

That's it.


For information on php extensions etc, on site.

  1. Create a new file and name it info.php (or some other name.php)

  2. Write this code in it:

     <?php
       phpinfo ();
     ?>
    
  3. Save the file in the root (home)of the site

  4. Open the file in your browser. For example: example.com/info.php All the php information on your site will be displayed.

Perhaps the easiest way to see which extensions are (compiled and) loaded (not in cli) is to have a server run the following:

<?php
$ext = get_loaded_extensions();
asort($ext);
foreach ($ext as $ref) {
    echo $ref . "\n";
}

PHP cli does not necessarily have the same extensions loaded.


Search extension in

/etc/php5/apache2/php.ini


You can view which modules (compiled in) are available via terminal through php -m


Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to linux

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt?

Examples related to ubuntu-12.04

Increasing Heap Size on Linux Machines wget: unable to resolve host address `http' How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS? java.lang.Exception: No runnable methods exception in running JUnits Speed up rsync with Simultaneous/Concurrent File Transfers? MySQL Job failed to start CronJob not running libz.so.1: cannot open shared object file error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied Package doesn't exist error in intelliJ

Examples related to php-extension

How to install all required PHP extensions for Laravel? How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS? Installing PHP Zip Extension How do I see the extensions loaded by PHP?