Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Composer says the requested PHP extension ext-http is missing

ErrorYour 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.

  • Applies to Composer 2.8, PHP 8.3, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 --ini
  2. 2Match what you see, then jump to its fix

    1. 1ext-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. 2php -m has no http line under any php.iniThe extension is not installed at allFix
    3. 3ext-http is demanded by one package you use for a feature you never callThe package does not need the extension in your caseFix

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 --ini

2Fix

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) install

3Verify

Run the platform list again with the same PHP.

php -m | grep -i '^http$'

Confirmed by php.net

Did this fix it?

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=http

3Verify

The module list now shows http.

php -m | grep -i '^http$'

Confirmed by pecl.php.net

Did this fix it?

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 http

2Fix

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-http

3Verify

Composer finishes, and your tests that touch that package pass.

composer check-platform-reqs

Confirmed by getcomposer.org

Did this fix it?

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

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 fix

Back 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

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.