PHP extensions, also called modules, add features to the PHP language: talking to databases, resizing images, encrypting data, reading XML and much more. Applications such as WordPress, Laravel and most shopping carts list the extensions they need. This guide explains what the common extensions do, and how to check which ones are loaded on your own hosting account.
Most PHP applications need the same core set: mysqli or pdo_mysql, curl, mbstring, openssl, xml, gd, zip, intl and fileinfo. To see what your account actually loads, run php -m over SSH, or upload a small test file that calls extension_loaded(). On shared hosting you can't install extensions yourself: if one is missing, ask support with the extension name and your PHP version.
1. Extensions, functions and libraries
An extension is compiled code loaded into PHP, such as gd or intl. Each one adds functions and classes, such as imagecreatefromjpeg() or NumberFormatter. A PHP library, such as one installed with Composer, is ordinary PHP code that runs on top of the extensions.
Two errors look similar but mean different things:
Call to undefined function imagecreatefromjpeg()means an extension is missing, heregd.imagecreatefromjpeg() has been disabled for security reasonsmeans the extension is loaded but the server has switched off that one function. See PHP disabled functions on shared hosting.
2. Core extensions that are always there
Some extensions are part of every PHP build and can't be switched off. You never need to ask for them.
| Extension | What it does |
|---|---|
| Core, standard | The language itself and basic functions such as strings, arrays and files |
| date | Dates, times and time zones |
| pcre | Regular expressions, the preg_* functions |
| json | Encoding and decoding JSON; always built in since PHP 8.0 |
| hash | Hashing with SHA-256 and other algorithms, and HMAC |
| Reflection | Inspecting classes and functions at run time, used by frameworks |
| SPL | Standard data structures, iterators and exceptions |
| random | Secure random numbers and the Randomizer class, since PHP 8.2 |
3. Databases
| Extension | What it does | Typical user |
|---|---|---|
| mysqlnd | The native MySQL driver that mysqli and pdo_mysql use | Loaded with them |
| mysqli | MySQL and MariaDB access, with prepared statements | WordPress, older scripts |
| PDO | One interface for many databases | Laravel, most modern code |
| pdo_mysql | The MySQL and MariaDB driver for PDO | Laravel, Symfony |
| pdo_sqlite, sqlite3 | SQLite, a database stored in a single file | Small apps, tests |
| pgsql, pdo_pgsql | PostgreSQL | Apps built for PostgreSQL |
| mongodb | MongoDB, installed from PECL | NoSQL applications |
For connecting PHP to your hosting database, see how to connect to the MySQL database.
4. Text, web and data formats
| Extension | What it does |
|---|---|
| mbstring | Multibyte string handling, needed for Hindi, Tamil and other non-Latin text in UTF-8 |
| iconv | Converting text between character encodings |
| intl | Locale-aware formatting of numbers, dates and currency, plus sorting and transliteration |
| ctype | Quick checks such as "is this all digits" |
| filter | Validating and cleaning input, such as email addresses and URLs |
| curl | HTTP requests to APIs and payment gateways |
| openssl | TLS connections, certificates and encryption |
| sodium | Modern encryption and signatures (libsodium) |
| xml, dom, SimpleXML | Reading and building XML and HTML documents |
| xmlreader, xmlwriter | Streaming large XML files without loading them all into memory |
| xsl | XSLT transformations of XML |
| soap | Calling or providing SOAP web services |
| gettext | Translating an application's text |
| tokenizer | Splitting PHP code into tokens, used by frameworks and tools |
| session | Keeping a user logged in across pages |
5. Files, images and compression
| Extension | What it does |
|---|---|
| fileinfo | Detecting a file's real type from its contents, important for safe uploads |
| gd | Creating and resizing images, thumbnails and captchas |
| imagick | Advanced image processing with ImageMagick, and more formats than gd |
| exif | Reading camera metadata from JPEG and TIFF photos |
| zip | Creating and opening ZIP archives, used by WordPress updates and plugin installs |
| zlib | gzip compression |
| bz2 | bzip2 compression |
| Phar | Running PHP archives such as composer.phar |
6. Maths, caching and other extensions
| Extension | What it does |
|---|---|
| bcmath | Exact decimal maths of any size, useful for money and accounting |
| gmp | Very large whole numbers, often used in cryptography |
| calendar | Converting between calendar systems |
| OPcache | Keeps compiled PHP in memory so pages run faster |
| apcu | An in-memory store for application data on one server |
| redis, memcached | Clients for Redis and Memcached cache servers |
| ldap | Logging in against a company directory |
| ftp | Connecting to FTP servers from PHP |
| sockets | Low-level network connections |
| posix, pcntl | Unix process information and process control, for command-line scripts |
| ionCube Loader | Runs commercial PHP scripts encoded with ionCube |
| xdebug | Step debugging and profiling, for development machines only |
A few names from older lists are gone. mysql was removed in PHP 7.0, so use mysqli or PDO. mcrypt and xmlrpc are no longer part of PHP and survive only as add-ons for old code. PHP 8.4 moved imap and pspell out of the core, so mailbox-reading scripts should be checked before an upgrade.
7. Check what is loaded on your account
A list of possible extensions is only half the answer. What matters is what your own site loads, for the PHP version it uses. phpinfo() is disabled on our cPanel servers, so use one of these methods instead.
Method 1: php -m over SSH
Jailed SSH access is available on every shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default; ask support to enable it for your account, and see enabling and accessing jailed SSH. Once you are logged in, cd into your site's folder and run:
php -v
php -m
php -m | grep -i intlThe command-line PHP can be a different version from your website, so compare php -v with the version set for your domain in the panel. If they differ, use Method 2.
Method 2: a test file
Create a file with a hard-to-guess name, such as ext-check-7q2.php, in your site's folder:
<?php
foreach (['mysqli', 'pdo_mysql', 'curl', 'mbstring', 'intl', 'gd', 'zip', 'sodium'] as $ext) {
echo $ext . ': ' . (extension_loaded($ext) ? 'loaded' : 'missing') . "\n";
}
echo 'PHP ' . PHP_VERSION;Open it in your browser, note the result, then delete the file. This shows exactly what your website sees. On cPanel, add ?t=1 to the address so you don't get a cached copy.
Method 3: WordPress Site Health
In WordPress, Tools › Site Health warns when a required or recommended extension is missing, and the Info › Server tab shows the PHP version and key settings.
On the default PHP 8.3 build, the common set (mysqli, pdo_mysql, curl, mbstring, intl, gd, zip, xml, openssl, fileinfo, exif, bcmath, soap) is loaded on both our cPanel and DirectAdmin servers. Imagick and PostgreSQL are loaded on cPanel but not DirectAdmin; ionCube Loader and sodium are loaded on DirectAdmin but not cPanel. Redis, Memcached, APCu, MongoDB and Xdebug are loaded on neither. Other PHP versions can differ, so always check your own account.
8. When an extension is missing
On shared hosting the server's PHP builds are shared by every account, so you can't install or compile an extension yourself, and a php.ini or .user.ini line can't load one. What you can do:
- Check your PHP version first.The extension may be available on another version. See how to change the PHP version.
- Use an alternative.WordPress falls back to
gdwhenimagickis missing, and ships a pure-PHP fallback forsodium. Many libraries have similar fallbacks. - Ask support.Open a ticket with the extension name, your domain and the PHP version. We will tell you whether it can be added for that version.
If your project needs extensions or a set-up that shared hosting can't offer, a VPS gives you root access to install exactly what you need. See how to enable essential PHP extensions on a VPS.
9. Where Domain India fits
Domain India cPanel and DirectAdmin shared hosting come with the extensions most PHP applications need already loaded, and a choice of PHP versions per account. For a full picture of what runs on the servers, see what software versions Domain India hosting runs and the hosting compatible technologies list.
- 50 GB NVMe SSD Storage
- 100 GB Monthly Bandwidth
- 5 Websites
- 50 Email Accounts
- 1 vCPU
- 2 GB DDR4 RAM
- 64 GB NVMe SSD Storage
- 2 TB Monthly Bandwidth
Card prices are live list prices, excluding 18% GST.
What is a PHP extension?
A PHP extension is compiled code loaded into PHP that adds functions and classes, such as gd for images, curl for HTTP requests or pdo_mysql for databases. Applications list the extensions they need in their requirements.
How do I check which PHP extensions are enabled without phpinfo?
Run php -m over SSH from inside your site's folder, or upload a small PHP file that prints extension_loaded('name') for each extension you need, open it in your browser and then delete it. phpinfo() is disabled on Domain India cPanel servers.
What does "Call to undefined function" mean?
It usually means the extension that provides the function is not loaded for your PHP version. A message saying a function "has been disabled for security reasons" is different: the extension is loaded but the server has switched that function off.
Can I install a PHP extension on shared hosting?
No. Shared servers use PHP builds shared by every account, so extensions can't be installed or loaded per account. Try another PHP version, or open a ticket with the extension name and PHP version. On a VPS you can install any extension yourself.
Which PHP extensions does WordPress need?
WordPress needs a MySQL driver (mysqli) and works best with curl, mbstring, openssl, xml, zip, exif, fileinfo, intl and either imagick or gd. Tools › Site Health in the dashboard tells you if a recommended extension is missing.
Is the mysql extension still available?
No. The old mysql extension was removed in PHP 7.0. Code that uses mysql_connect() must be updated to mysqli or PDO.
Ready to check your account? Upload the test file from section 7, compare the result with your application's requirements, and open a support ticket with the extension name and PHP version if anything is missing, or compare VPS plans if you need full control.
Tell us the extension name, your domain and the PHP version your site uses, and we will check what is available for your account.
Open a support ticket