This brief tutorial shows students and new users how to list all compiled and installed PHP extensions on Ubuntu Linux.
A few days ago, I upgraded from PHP 7.2 to PHP 7.3, and all related extensions were installed with PHP 7.2, supporting my WordPress websites and blogs. I wanted to upgrade only the extensions currently installed with PHP 7.2.
Learning to list installed PHP modules on Ubuntu Linux can be useful for various reasons, such as troubleshooting PHP-related issues or determining if a specific module is installed and available.
It can also help you identify which modules must be added or removed based on your PHP requirements. In addition, knowing which modules are installed can help you optimize the performance of your PHP applications and websites.
Overall, being able to list installed PHP modules is an essential skill for anyone working with PHP on Ubuntu Linux.
List PHP Compiled Extensions
PHP / PHP-FPM has a list of all extensions that are compiled by default on Ubuntu. But not necessarily installed and in use. Extensions that are compiled with PHP installation are available to be used when necessary.
With a standard PHP install, not every library is compiled and installed — so if some functions are not working, you should look at what PHP extensions are compiled and installed.
So, to list compiled PHP / PHP-FPM extensions, run the commands below
php -m
That should show you something similar to the list below:
[PHP Modules] calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary imagick json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline redis Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache
List PHP Installed Extension
Now, to find out what PHP / PHP-FPM extensions are installed, you run the commands below:
dpkg --get-selections | grep -i php
You should see a similar list below:
php install php-common install php-igbinary install php-imagick install php-redis install php7.2-cli install php7.2-common install php7.2-curl install php7.2-fpm install php7.2-gd install php7.2-json install php7.2-mbstring install php7.2-mysql install php7.2-opcache install php7.2-readline install php7.2-tidy install php7.2-xml install php7.2-xmlrpc install php7.2-zip install
That’s how you know which extensions are installed
So, if you only want to install PHP 7.3 extensions of what is currently installed with PHP 7.2, use the commands above to list installed PHP extensions, then install those PHP 7.3 versions.
That’s it!
Congratulations! You have learned how to list PHP extensions to determine which are compiled and installed.
You may also like the post below:
Leave a Reply Cancel reply