PHP cURL errors often happen because CLI and web PHP use different builds or php.ini files.
Symptoms
- Call to undefined function curl_init().
- Composer requires ext-curl.
- The extension works in CLI but not through the website, or the reverse.
Likely causes
- cURL extension is not installed for the active PHP version.
- CLI and PHP-FPM use different configurations.
- Docker image does not install or enable curl.
Fix steps
- Check php -m and phpinfo() for curl.
- Install the curl extension for the exact PHP version.
- Restart PHP-FPM or the container after enabling it.
- Update Dockerfile when the missing extension is inside an image.
Verify the fix
- Run php -m | grep curl.
- Check web phpinfo() carefully, then remove it.
- Re-run Composer or the failing HTTP request.
FAQ
Why does CLI work but the site fails?
They may use different PHP binaries, ini files or containers.
Is ext-curl the same as the curl command?
No. PHP extension support and the shell curl binary are separate.
Related tools and guides
Last updated: May 18, 2026