Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer update: The requested PHP extension ext-http missing

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!

like image 910
Matti VM Avatar asked Feb 13 '19 16:02

Matti VM


Video Answer


2 Answers

Update: It might be worth looking at the other answers too. Since I'm no longer working with PHP, I'm not going to set up a project and try to recreate the problem I had just to test the new suggested solutions. If another answer did help you, give it a vote '^' this way I know which answers are useful. As soon as one has more votes than this one I'll mark it as the solution.


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

like image 179
Matti VM Avatar answered Sep 22 '22 14:09

Matti VM


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 
like image 27
Francesco Abeni Avatar answered Sep 19 '22 14:09

Francesco Abeni