Composer update: The requested PHP extension ext-http missing
Asked Answered
A

11

38

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!

Assignation answered 13/2, 2019 at 16:53 Comment(4)
#22332531Gunnar
Could you post the contents of your composer.json?Name
@Gunnar I already looked at that question, but it didn't help. He is looking for 'ext-intl' but that I can find in my 'php.ini' but not ext-http.Assignation
I am also getting this error but "ext-http": "*", has always been in my composer.json since years ago. Composer has never complained before, no env changes. What's up with that? Oddly enough, it's hard to find any info on such an extension... I don't ever remember explicitly installing such an extension either. What on earth is it?Akim
B
26

in my case i'm using ubuntu, hope this solve the problem.

sudo apt install php-http
Becka answered 10/6, 2020 at 19:1 Comment(1)
How this should be an answer as OP operating system is Windows ?Mcgowen
A
42

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


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

Assignation answered 14/2, 2019 at 9:22 Comment(9)
This got added to my composer.json as well. PhpStorm added it to get rid of a code warning. I am wondering if you using Phpstorm?Typical
@Typical Yes I am using PhpStorm but I have never seen a message/warning/notification about a code warning that made PhpStorm add it to the composer.json.Assignation
ext-http inside composer.json is just to indicate that the Composer project (or a library) depends on functionality provided by ext-http. Removing that line does not necessarily solve the problem - it just makes the warning go away, but code that uses ext-http functionality will still break - most probably in very specific situations. This situation applies with other extensions too, by the way. Composer doesn't really know if your code/project uses a dependency or not - this applies to ext- as well as normal depedencies.Malines
This "answer" should be downvoted 23 times, not upvoted. This "answer" doesn't solve the problem.Cadman
@emix don't be hard on him, he just hiding the problem not even trying to fix itCallipygian
@Callipygian Oh but I did try to fix it. At the time of posting my "solution" people just didn't suggest a solution that was better than my "hiding the problem"-solution (or didn't suggest a solution that even worked for me). You probably also didn't read my update?! I'm no longer using PHP. I'm not gonna do a full setup again and try to reproduce the problem. So I can't and won't check the correctness of these new answers. People are free to vote for other solutions. But hey... I'm not trying to be hard on you, but you didn't even try to post a solution yourself.Assignation
This is NOT the answer. Removing the line in composer.json only hides the warning. Check at other answers (installing with apt or pecl)Hemianopsia
It is funny that this is upvoted and the accepted answer. It is like removing the alarm from your car because the alarm keeps going off erroneously and you put in (unconnected) into the back seat and you sleep well at night thinking that if somebody tries to steal your car, the alarm will soundPhalarope
PHP 8.0 don´t support http anymore. It´s necessary to remove it from package.json.Mungo
B
26

in my case i'm using ubuntu, hope this solve the problem.

sudo apt install php-http
Becka answered 10/6, 2020 at 19:1 Comment(1)
How this should be an answer as OP operating system is Windows ?Mcgowen
L
3

In case someone needs it, one can also install it with pecl
(it needs extensions raphf and propro loaded to build):

yum install libcurl-devel brotli-devel
pecl install pecl_http

...
Build process completed successfully
Installing '/usr/lib64/php/modules/http.so'
Installing '/usr/include/php/ext/http/php_http.h'
Installing '/usr/include/php/ext/http/php_http_api.h'
Installing '/usr/include/php/ext/http/php_http_buffer.h'
Installing '/usr/include/php/ext/http/php_http_client.h'
Installing '/usr/include/php/ext/http/php_http_client_curl.h'
Installing '/usr/include/php/ext/http/php_http_client_curl_event.h'
Installing '/usr/include/php/ext/http/php_http_client_curl_user.h'
Installing '/usr/include/php/ext/http/php_http_client_request.h'
Installing '/usr/include/php/ext/http/php_http_client_response.h'
Installing '/usr/include/php/ext/http/php_http_cookie.h'
Installing '/usr/include/php/ext/http/php_http_curl.h'
Installing '/usr/include/php/ext/http/php_http_encoding.h'
Installing '/usr/include/php/ext/http/php_http_encoding_brotli.h'
Installing '/usr/include/php/ext/http/php_http_encoding_zlib.h'
Installing '/usr/include/php/ext/http/php_http_env.h'
Installing '/usr/include/php/ext/http/php_http_env_request.h'
Installing '/usr/include/php/ext/http/php_http_env_response.h'
Installing '/usr/include/php/ext/http/php_http_etag.h'
Installing '/usr/include/php/ext/http/php_http_exception.h'
Installing '/usr/include/php/ext/http/php_http_filter.h'
Installing '/usr/include/php/ext/http/php_http_header.h'
Installing '/usr/include/php/ext/http/php_http_header_parser.h'
Installing '/usr/include/php/ext/http/php_http_info.h'
Installing '/usr/include/php/ext/http/php_http_message.h'
Installing '/usr/include/php/ext/http/php_http_message_body.h'
Installing '/usr/include/php/ext/http/php_http_message_parser.h'
Installing '/usr/include/php/ext/http/php_http_misc.h'
Installing '/usr/include/php/ext/http/php_http_negotiate.h'
Installing '/usr/include/php/ext/http/php_http_object.h'
Installing '/usr/include/php/ext/http/php_http_options.h'
Installing '/usr/include/php/ext/http/php_http_params.h'
Installing '/usr/include/php/ext/http/php_http_querystring.h'
Installing '/usr/include/php/ext/http/php_http_response_codes.h'
Installing '/usr/include/php/ext/http/php_http_url.h'
Installing '/usr/include/php/ext/http/php_http_utf8.h'
Installing '/usr/include/php/ext/http/php_http_version.h'
install ok: channel://pecl.php.net/pecl_http-3.2.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini
Laminitis answered 10/8, 2020 at 7:47 Comment(1)
pecl install pecl_http did solves my problem ThanksSansone
F
3

For those who encountered with this problem:

- The requested PHP extension ext-http * is missing from your system.

The solution is just to install PHP extension:

sudo apt install php-pecl-http
Fusionism answered 7/10, 2020 at 20:19 Comment(2)
You know on windows how could get this?Myxomycete
OP operating system is WindowsMcgowen
R
2

I had the same problem too. My problem was that when I use RuntimeException class, I made a mistake by import use http\Exception\RuntimeException; instead of the standard one use RuntimeException. And the class http\Exception\RuntimeException; required ext-http extension. So my suggestion is that, you should search your all project and check whether you made the same mistake as mine or not. You can search all by keyword use http\. Btw I don't think install or unstall ext-http plugin will solve the problem.

Rumelia answered 3/11, 2021 at 15:30 Comment(0)
J
2

if you have xamp like me:

composer i `--ignore-platform-req=ext-http

//or

composer u `--ignore-platform-req=ext-http
Jolley answered 12/5, 2023 at 20:17 Comment(0)
L
1

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.

Lynxeyed answered 13/2, 2019 at 17:54 Comment(0)
K
0

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

Kuvasz answered 13/2, 2019 at 17:15 Comment(0)
L
0

Had the same problem in composer.json file. Also discovered, that I have an "ext-http": "*". To solve this problem just delete the "ext-http": "*" and try to install package again. Worked for me, hope for you too :)

Luckless answered 29/8, 2021 at 5:28 Comment(0)
I
0

In my case, the combination worked (Ubuntu php7.4)

sudo apt install php-pear
pecl install pecl_http
Iila answered 5/10, 2021 at 9:31 Comment(0)
T
0

Running the command php -m will list all the modules currently enabled.

If you look at the top and see this warning:

PHP Warning:  Cannot load module "http" because required module "raphf" is not loaded

You just need to install ext-raphf as well.

If you are on Ubuntu, just run sudo apt install php-raphf.

Tornado answered 26/7 at 11:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.