View Tutorial Metadata Edit Content Revision History Add to Watchlist Add New Tutorial How to check if a PHP extension is installed

Checking if your system has a PHP extension installed

How to check the installation of a PHP extension

PHP features a set of extensions which you can use on your system. To see how to enable a certain extension, check out this other tutorial, Enabling a PHP extension

From the Command Line Interface

Assuming you have access to the command line on the system where you want to check, you can simply use

php -i

This will display (among other information) information about all the installed modules. On Linux, you can use | grep to filter the output and see if it contains the one you're looking for. For isntance, if you wanted to see if "libxml" is installed, you could try:

php -i | grep libxml

On a remote server

It's a common situation that you only have access to PHP through your web server. In this case, you should read Obtaining information about your PHP Installation with phpinfo() .

Let's assume you don't want to display ALL the php information, just the loaded extensions. In this case, you could use inside the phpinfo file:

<?php phpinfo(INFO_MODULES); ?>

If you can find your module in the generated list of modules, then it's installed and available for use.

Only plain text supported.

Optional

Required - will be kept private

Optional

 
 

Rating: (0+, 0-) In: PHP 5