Composer says the requested PHP extension ext-http is missing
Your requirements could not be resolved to an installable set of packages.Short answer
ext-http is the PECL extension pecl_http, not part of PHP itself. Composer reports it missing when no loaded php.ini enables it for the PHP that runs Composer. Check which PHP Composer uses, install and enable the extension for that PHP, or ignore the requirement for that one package if your code never calls it.
Fix it fast
1Find out which cause you have
See which platform packages Composer can see for the PHP it is running under. If ext-http is not listed, Composer is right.
composer show --platform | grep -i -E "^php |ext-http" php --ini2Match what you see, then jump to its fix
- 1
ext-http shows as loaded for the web server, but composer show --platform does not list itComposer runs a different PHP than the one you configuredFix - 2
php -m has no http line under any php.iniThe extension is not installed at allFix - 3
ext-http is demanded by one package you use for a feature you never callThe package does not need the extension in your caseFix
- 1
What does the error look like?
Your requirements could not be resolved to an installable set of packages.requires ext-http * -> it is missing from your system. Install or enable PHP's http extension.
Cause 1 of 3
Composer runs a different PHP than the one you configured
1Check
The command line and the web server can load different php.ini files. php --ini prints the files the CLI reads.
which -a php
php --ini2Fix
Enable the extension in the ini file the CLI loads, or run Composer with the PHP binary you configured.
/usr/bin/php8.3 $(which composer) install3Verify
Run the platform list again with the same PHP.
php -m | grep -i '^http$'Confirmed by php.net
Cause 2 of 3
The extension is not installed at all
1Check
pecl_http is a PECL extension. It needs PHP 8.0 or newer, the raphf extension, and the hash and iconv extensions. PECL is deprecated, and the PECL page points to PIE as its replacement.
php -m | grep -i -E '^(http|raphf|hash|iconv)$'2Fix
Build and install the extension following the pecl_http package page (PECL or PIE), then add it to the ini file the CLI loads. Restart PHP-FPM or Apache afterwards for the web side.
; php.ini or a file in conf.d
extension=http3Verify
The module list now shows http.
php -m | grep -i '^http$'Confirmed by pecl.php.net
Cause 3 of 3
The package does not need the extension in your case
1Check
Composer treats ext-* as a platform package that it cannot install. It stops the install when one is absent.
composer show --platform | grep -i http2Fix
Ignore only this requirement for the command. Do not use --ignore-platform-reqs, which switches every check off. Do this only when your code never reaches the feature that needs the extension.
composer install --ignore-platform-req=ext-http3Verify
Composer finishes, and your tests that touch that package pass.
composer check-platform-reqsConfirmed by getcomposer.org
How do I stop it coming back?
- Keep the CLI and the web server on the same PHP version, and compare php --ini for both.
- Run composer check-platform-reqs in the deploy script so a missing extension is caught before the release goes live.
- Avoid config.platform to hide missing extensions; the docs warn it makes the checks unreliable.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer refuses to install because a PHP extension is missing
The requested PHP extension bcmath * is missing from your system.
Composer checks the PHP that runs it, not the PHP your web server uses.
3 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 3 loads the model but the property is undefined
The model name you are loading is the name of a resource that is already being used: user
CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.
2 causes, each with a fix