How to list all installed PHP extensions

Many times, web hosting owners are asking if a specific PHP extension is installed on the server or not. You can check easily with a simple PHP script. We will mainly use the get_loaded_extensions PHP function to get the list of the extensions.

Just create a new php file – phpextensions.php – with the following content and open it in your preferred web browser:

<?php
// prints e.g. 'Current PHP version: 8.0.1'
echo 'Current PHP version: ' . phpversion(). '<br/>';

// lists all PHP extensions

foreach (get_loaded_extensions() as $i => $ext)
{
   echo $ext .' => '. phpversion($ext). '<br/>';
}
?>
Installed PHP extensions

On a test server the result is:

Current PHP version: 8.0.3

Core => 8.0.3
date => 8.0.3
libxml => 8.0.3
openssl => 8.0.3
pcre => 8.0.3
sqlite3 => 8.0.3
zlib => 8.0.3
bcmath => 8.0.3
calendar => 8.0.3
ctype => 8.0.3
curl => 8.0.3
dom => 20031129
hash => 8.0.3
fileinfo => 8.0.3
filter => 8.0.3
ftp => 8.0.3
gd => 8.0.3
gettext => 8.0.3
SPL => 8.0.3
iconv => 8.0.3
intl => 8.0.3
json => 8.0.3
mbstring => 8.0.3
session => 8.0.3
standard => 8.0.3
mysqlnd => mysqlnd 8.0.3
PDO => 8.0.3
pdo_mysql => 8.0.3
pdo_sqlite => 8.0.3
Phar => 8.0.3
posix => 8.0.3
Reflection => 8.0.3
mysqli => 8.0.3
SimpleXML => 8.0.3
soap => 8.0.3
sockets => 8.0.3
sodium => 8.0.3
exif => 8.0.3
tokenizer => 8.0.3
xml => 8.0.3
xmlreader => 8.0.3
xmlwriter => 8.0.3
xsl => 8.0.3
zip => 1.19.2
cgi-fcgi => 8.0.3
imagick => 3.4.4
imap => 8.0.3
Zend OPcache => 8.0.3

Related Articles:
How to change PHP site version in DirectAdmin

References:
phpversion manual
get_loaded_extensions manual

Leave a Reply