Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see the extensions loaded by PHP?

People also ask

How do I see PHP extensions?

If your server only has a single PHP version installed, you can run this PHP command anywhere, and it will give you the same list of modules. The general command we will be using is php -m. This command will give you the full list of installed PHP modules/extensions.

How do I view PHP libraries?

The general command is php -m , which will show you a list of all “compiled” PHP modules. You can search for a specific PHP module for instance php-ftp , using the grep command.


Running

php -m
will give you all the modules, and
php -i
will give you a lot more detailed information on what the current configuration.

Run command. You will get installed extentions:

php -r "print_r(get_loaded_extensions());"

Or run this command to get all module install and uninstall with version

dpkg -l | grep php5

You want to run:

 php -m 

on the command line,

or if you have access to the server configuration file open

/etc/php5/apache2/php.ini

and look at all the the extensions,

you can even enable or disable them by switching between On and Off like this

<Extension_name> = <[On | Off]>

use get_loaded_extensions() PHP function


  <?php 
      echo "<pre>";
      print_r(get_loaded_extensions());
      echo "<pre/>";
 ?>

If you want to test if a particular extension is loaded you can also use the extension_loaded function, see documentation here

php -r "var_dump(extension_loaded('json'));"