Composer更新:请求的PHP扩展名ext-http丢失

I am creating a php website using the symfony framework and composer.

  • Operating system: Windows 10
  • PHP version: 7.3.2
  • Symfony: 4.2.3 (env: dev, debug: true)
  • Composer: 1.8.4 (2019-02-11)

When I try to do compose update inside the projects folder or when I try to install a bundle using composer require symfony/swiftmailer-bundle I get the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-http * is missing from your system.
      Install or enable PHP's http extension.

(It says 'Problem 1', but it is the only problem listed.)

I already looked for the extension in my php.ini file, but I can't find it. Do I need to install an extension manually? If so, where can I find it?

Thanks in advance!

The solution is found. For some reason my composer.json contained "ext-http": "*".

"require": {
    "ext-http": "*"
}

Removing this line fixed the problem. I don't know why it contained "ext-http": "*" and I don't fully understand why removing it would fix the problem. (Is it because it is looking for the extension, but can not find it?)

(Thank you to everyone trying to help me fix the problem!)

Have you already tried the options here for similar issues?

I have not experienced this issue on WAMP stacks yet... but it looks like some related articles (where this particular item 'ext-http' is not the issue) could be helpful.

When I've had similar issues on LAMP stacks, it usually meant that I did need to install the item mentioned... though sometimes Composer was a bit misleading as to the actual item needed.


Example #1 (LAMP)... actual item described was needed:

composer require phpoffice/phpspreadsheet
  • Error produced: missing php-mstring

  • Solution:

    yum install php-mbstring


Example #2 (LAMP)... something slightly different than the item described was needed:

composer require phpoffice/phpspreadsheet
  • Error produced: missing ext-zip

  • Solution:

    yum install php-pecl-zip


Also, perhaps running composer in verbose mode?

But, I think your best bet to start is the first link provided in this answer (and then looking through similar WAMP Composer missing item issues).

According to PHP Official Documentation, You'll have to find your extension in php.ini and uncomment it OR add it in general. It's probably something like extension=php_http.dll.

php-http is a standard which is implemented by different packages. ext-http is the Composer way to tell that your application requires at least one of those packages. See the section called "Composer virtual packages" at http://docs.php-http.org/en/latest/clients.html for additional details.

Differently than other packages, the ext-... lines do not actually install anything via composer, they just make composer check that you have some required dependency. Usually you can just install the corresponding PHP library, e.g. ext-zip means that you need to install php-zip. In this case, there is no single PHP library but a series of compatible libraries.

You should be able to fix your issue by installing one of the provided packages, e.g.

composer require php-http/curl-client

i am having same problem but i dont have that line in my composer.json

"require": { "ext-http": "*" }

I dont this