How do you check if php extension is installed?

Skip to content

How do you check if php extension is installed?

Suppose you are facing library issues, you get the library functions error then first you need to check the module is loaded or not. It is very easy to confirm the library is installed or not. In this article, I will let you know how can you check the PHP extensions are loaded or not.

Using Command Line:

If you using a command line then you can use the below command to get all module lists.

php -m
How do you check if php extension is installed?

If you want details information, you can use php -i to get phpinfo(); response.

php -i
How do you check if php extension is installed?

Run below command to check all loaded extensions by PHP:

php -r "print_r(get_loaded_extensions());"
How do you check if php extension is installed?

Check specific extensions whether extension is installed or not.

php -r "print_r(get_loaded_extensions('gd'));"
How do you check if php extension is installed?

If you want to uninstall all modules and install all again. Use below command with PHP version.

dpkg -l | grep php5

To view all PHP command-line options, run below command.

 php -h

Using PHP code:

You can show all PHP information by using the below code. You can find the extension name. Do ctrl+f and search the extension name.

How do you check if php extension is installed?

To get all loaded extensions, please use below code.

";
      print_r(get_loaded_extensions());
      echo "
";
 ?>
How do you check if php extension is installed?

You can also check any specific extensions whether the extension is installed or not. In the below code, I checked GD Library is installed or not. Thus you can check for other extensions also.

How do you check if php extension is installed?

Thanks for reading, feel free to reach out to me for any comments and suggestions. I hope you found the article helpful and you were able to fix the PHP library issues..

How do I know what PHP extensions are installed on Windows?

PHP extensions are usually called "php_*. dll" (where the star represents the name of the extension) and they are located under the "PHP\ext" folder.

How do you check PHP extensions is installed or not ?

Using Command Line:.
If you want details information, you can use php -i to get phpinfo(); response. ... .
Run below command to check all loaded extensions by PHP: php -r "print_r(get_loaded_extensions());".
Check specific extensions whether extension is installed or not..

How do I know what PHP extensions are installed Linux?

Verify the version of PHP and existing modules on the server by using the following command:.
RHEL®/CentOS®: yum list installed | grep -i php..
Debian® or Ubuntu®: dpkg --get-selections | grep -i php..

Where is my PHP extension directory?

So after installation of PHP the best way to identify the extension directory is to open php info file and check for all the settings. In the php info display it will be written where the extension file of the system is stored. It is also known as extension_dir .