iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The message means the PHP runtime handling your command or web request does not have the cURL extension loaded. Install or enable cURL for that exact PHP installation, restart the process that uses PHP, and verify through the same SAPI (CLI, Apache, PHP-FPM, IIS, or Composer) that originally failed.
PHP’s cURL functions are a wrapper around libcurl. Installing a system curl command alone does not necessarily install the PHP extension, and enabling it for command-line PHP does not automatically enable it for a web server.
What the error actually means
PHP exposes HTTP, HTTPS, FTP and other network operations through the cURL extension. When that extension is absent, disabled, built for a different PHP version, or unable to load one of its dependencies, applications can report messages such as:
cURL is not installed in your PHP installationComposer says ext-curl is missingCall to undefined function curl_init()PHP Startup: Unable to load dynamic library curl
The fix depends on the operating system, PHP minor version, installation method and SAPI. A common source of confusion is that php in a terminal and PHP serving an Apache, Nginx, PHP-FPM or IIS request may be different versions with different php.ini files.
#1 Best Overall
First identify the PHP runtime that failed
Do not change configuration until you know which PHP executable and configuration file are active. Run these commands in the environment where the error appears:
Check command-line PHP
- Display the CLI version and build:
php -v - Display the loaded configuration file and additional scan directories:
php --ini - Check whether cURL is listed among loaded modules:
php -m | grep -i curlOn systems without
grep, usephp -mand inspect the output manually. - Ask PHP directly whether the extension is loaded:
php -r 'var_dump(extension_loaded("curl"));'A working extension prints
bool(true). - Show cURL-specific information, including the linked libcurl version, when available:
php --ri curl
If php --ini reports no loaded configuration file, or a file you did not expect, editing another php.ini will have no effect.
Check a web request
Create a temporary file in the document root, for example curl-check.php:
<?php
var_dump(PHP_VERSION);
var_dump(PHP_SAPI);
var_dump(php_ini_loaded_file());
var_dump(extension_loaded('curl'));
?>
Open that file through the same URL, virtual host and authentication path as the failing application. The output identifies the web server’s PHP version, SAPI, active configuration file and cURL status. Delete the file immediately after testing; a publicly accessible diagnostic page can disclose paths and configuration details.
For a web application, also check the application’s actual execution path. A Composer command may run under CLI PHP, while a framework job may run under a queue worker, and a browser request may run under PHP-FPM. Each process must have cURL enabled independently.
Rank #2
Install cURL on Debian or Ubuntu
Distribution packages normally install the PHP extension and its libcurl dependencies together. Install the package corresponding to the PHP version that is actually running.
Free tools Windows power users keep installed
One-click scans. No signup required.
Use the distribution’s default PHP package
sudo apt update
sudo apt install php-curl
The unversioned php-curl package follows the distribution’s default PHP stream. This is appropriate only when the active PHP installation comes from that stream.
Use a versioned package when required
If php -v or the web check shows a specific minor version and your repository provides versioned packages, install the matching package, for example:
sudo apt install php8.3-curl
Do not install an arbitrary minor version merely because it is available. A package for PHP 8.3 will not fix a PHP 8.2 process if the two installations use separate module directories.
Restart the PHP consumer
Loading a new shared extension requires the process using PHP to start again. Restart the service that handles the failing request:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →- Apache: restart the Apache service, using your distribution’s service manager.
- Nginx with PHP-FPM: restart the PHP-FPM service for the active PHP minor version; reload Nginx if your deployment requires it.
- A long-running queue worker, supervisor process or application server: stop and start that worker.
For a one-shot CLI command, no service restart is needed; invoke php again after installation. MediaWiki’s current local-development instructions include php-curl among Debian/Ubuntu prerequisites, which reflects the normal package-based setup.
Enable cURL on Windows
Windows PHP distributions generally include the cURL extension DLL, but it may be disabled in the configuration or unable to find dependent DLLs.
Find the correct php.ini
- Open Command Prompt or PowerShell in the same context as the failing command.
- Run
php --iniand note the path after
Loaded Configuration File. - For a web request, use the temporary diagnostic page instead. The web server may load a different
php.inifrom the CLI. - Back up the active configuration file, then open it with an editor running appropriate permissions.
Enable the extension and verify extension_dir
In the active php.ini, ensure the cURL extension is enabled. Depending on the PHP build, the line may appear as extension=curl or extension=php_curl.dll. Remove a leading semicolon if the line is commented out. Confirm that extension_dir points to the ext directory belonging to the same PHP installation, such as the directory containing php_curl.dll.
Do not copy a DLL from another PHP release, architecture or thread-safety variant. A 32-bit extension cannot be loaded by 64-bit PHP, and a DLL built for a different PHP minor version or thread-safety model can produce startup errors.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Install the required dependent DLLs
PHP’s Windows cURL documentation states that the extension also needs the OpenSSL libraries (files matching libcrypto-*.dll and libssl-*.dll) and libssh2.dll available on the system PATH. Use the DLLs shipped with the matching PHP build, or a compatible dependency package supplied for that build. Do not download an unrelated libcurl.dll and place it randomly in the Windows directory; mismatched dependencies can cause a different startup failure or security problem.
Rank #4
After editing php.ini or changing PATH, restart Apache, IIS, PHP-FPM or the relevant worker. Close and reopen a terminal if it retains an old environment.
Source-built PHP: compile against libcurl
If PHP was compiled from source, installing a distribution extension package will not attach it to that custom build. PHP must be configured with cURL support and linked to a usable libcurl installation.
- Install the libcurl development headers and library for your operating system.
- Configure PHP with the cURL option, supplying a directory when the headers and libraries are not in standard locations:
./configure --with-curl=DIRHere,
DIRmust resolve to the installation containing the cURL headers and libcurl library. - Rebuild and install PHP using the same prefix and build options as the existing installation.
- Confirm that the resulting PHP binary or SAPI loads the rebuilt extension with
php --ri curland the web diagnostic check.
The PHP manual states that PHP generally requires libcurl 7.10.5 or newer. Its current requirements list higher minimums for newer PHP releases: libcurl 7.15.5 for PHP 7.3 and later, 7.29.0 for PHP 8.0 and later, and 7.61.0 for PHP 8.4 and later. Treat the requirement that applies to your PHP release as mandatory; an older system library can make configuration fail or leave cURL unavailable.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Make Composer use the PHP that has cURL
Composer evaluates platform requirements using the PHP process that launches it. If Composer reports a missing ext-curl requirement while curl appears in a browser’s phpinfo(), the two processes are using different SAPIs or installations.
- Identify the PHP Composer invokes:
which php
php -v
php --iniOn Windows, use
where phpinstead ofwhich php. - Check that same binary:
php -r 'var_dump(extension_loaded("curl"));' - If the result is
false, install or enable cURL for that CLI PHP version, then start a new Composer process. - If multiple PHP versions are installed, call Composer through the intended binary or correct the system
PATH. Verify the result withcomposer check-platform-reqswhen that command is available for your project.
Do not “fix” a genuine missing extension by adding --ignore-platform-req=ext-curl. That only suppresses Composer’s check; code that calls cURL can still fail at runtime.
Why CLI works but Apache or PHP-FPM fails
CLI and web PHP commonly differ in all of the following:
| Difference | What to inspect | Typical correction |
|---|---|---|
| PHP version | php -v versus the web diagnostic page |
Install cURL for the version serving the request, or point the web server to the intended version. |
| Configuration file | php --ini versus php_ini_loaded_file() |
Enable cURL in the configuration file actually loaded by that SAPI. |
| SAPI | PHP_SAPI |
Restart the corresponding Apache module, PHP-FPM pool or IIS handler. |
| Extension directory | php -i or the web diagnostic output for extension_dir |
Correct the path so it contains the extension built for that PHP installation. |
| Process lifetime | Service and worker start times | Restart long-running workers after changing modules or environment variables. |
For PHP-FPM, make sure the restarted pool is the one configured in the Nginx site. A server can have several pools for different PHP minors, each with its own socket and service unit.
Fix “PHP Startup: Unable to load dynamic library curl”
A startup warning usually identifies the immediate failure. Read the complete message before changing unrelated settings.
The file cannot be found
Check that the cURL extension file exists in the configured extension_dir. On Windows, confirm that the active PHP directory and its ext directory are the ones referenced by php.ini. On Linux, reinstall the package matching the running PHP minor version and inspect the module path reported by PHP.
A dependency cannot be found
Windows warnings mentioning OpenSSL, libssh2.dll or another DLL indicate a dependency or PATH problem. Put the compatible libraries on PATH, restart the process, and test again. Replacing only the cURL DLL usually does not solve a missing dependency.
Architecture or build mismatch
Match all of these attributes: PHP major and minor version, 32-bit or 64-bit architecture, thread safety, compiler runtime and build source. Remove duplicate PHP directories from PATH so the service cannot load a different binary than the one you inspected.
Recommended Free Tools
Duplicate extension declarations
If the extension is loaded once and PHP then reports a duplicate-module warning, search the main php.ini and scanned configuration directories for multiple cURL declarations. Keep one valid declaration and restart the consumer.
Use the error message to choose the next check
| Symptom | Most likely cause | Next action |
|---|---|---|
extension_loaded('curl') is false in CLI |
CLI cURL package is absent or disabled | Run php --ini, install the matching package or enable the extension, then retest. |
| CLI is true, web check is false | Different PHP version, SAPI or configuration | Compare version, SAPI, ini path and extension directory from both environments. |
php --ini shows an unexpected file |
Wrong executable or PHPRC/service configuration |
Correct the executable or service configuration before editing files. |
| Startup warning names a missing DLL | Dependency is absent or not on PATH |
Install the compatible dependency and restart the process. |
Composer alone reports ext-curl missing |
Composer uses another CLI PHP | Inspect which php/where php, then enable cURL for that binary. |
| Package installation succeeds but status is unchanged | Service was not restarted or the package targets another PHP minor | Restart the consumer and verify the package and runtime versions match. |
Verify the repair through every affected path
Verification is complete only when the process that originally failed reports cURL as loaded.
Quick Recap
- CLI: run
php -m | grep -i curl
php --ri curl
php -r 'var_dump(extension_loaded("curl"));' - Web server: reload the temporary diagnostic page and confirm the displayed SAPI, PHP version, ini path and
bool(true). - Composer: run the project’s platform check or the command that previously stopped, using the same user and PHP binary.
- Workers and scheduled jobs: restart them and execute a safe test job. A worker that started before the extension was installed can retain the old module state.
- Application behavior: test the specific HTTPS API, package install or callback that required cURL. A loaded extension proves availability, not that a remote endpoint, certificate or proxy is configured correctly.
Important distinctions and safety checks
- The operating-system
curlexecutable and PHP’scurlextension are separate. Having one does not prove the other is installed. - Changing
disable_functions, certificate settings or unrelated PHP options will not load a missing extension. - Use package repositories or the PHP build’s official distribution for binaries. Mixing DLLs or shared objects from unrelated releases can create loader errors.
- Keep diagnostic pages private and remove them after testing.
- Record the PHP version, SAPI, ini path and extension status when escalating an issue; those four details make environment differences visible.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

