31

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!

Matti VM
  • 1,074
  • 1
  • 11
  • 18
  • 2
    https://stackoverflow.com/questions/22332031/composer-the-requested-php-extension-ext-intl-is-missing-from-your-system – FAEWZX Feb 13 '19 at 17:00
  • Could you post the contents of your composer.json? – dbrumann Feb 13 '19 at 17:00
  • 1
    @FAEWZX 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. – Matti VM Feb 14 '19 at 09:15
  • 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? – Yes Barry Jul 31 '19 at 19:43

10 Answers10

43

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

Matti VM
  • 1,074
  • 1
  • 11
  • 18
  • 2
    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? – ScottGutman Feb 23 '19 at 03:24
  • @ScottGutman 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. – Matti VM Feb 24 '19 at 09:33
  • 29
    `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. – Christian Mar 17 '20 at 03:10
  • 18
    This "answer" should be downvoted 23 times, not upvoted. This "answer" doesn't solve the problem. – Mike Doe Aug 10 '20 at 08:14
  • 2
    @emix don't be hard on him, he just hiding the problem not even trying to fix it – Thamer Mar 24 '21 at 18:13
  • @Thamer 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. – Matti VM Jun 18 '21 at 13:05
  • This is NOT the answer. Removing the line in composer.json only hides the warning. Check at other answers (installing with apt or pecl) – bloub Sep 21 '21 at 16:08
  • 1
    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 sound – Ste Sep 01 '22 at 13:16
18

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

sudo apt install php-http
sh6210
  • 4,190
  • 1
  • 37
  • 27
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
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
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
Ruslan Skaldin
  • 981
  • 16
  • 29
1

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
VuVanLy
  • 69
  • 6
1

if you have xamp like me:

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

//or

composer u `--ignore-platform-req=ext-http
saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58
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).

Community
  • 1
  • 1
Michael M.
  • 61
  • 5
0

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.

Anthony Harley
  • 1,327
  • 1
  • 8
  • 16
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 :)

0

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

sudo apt install php-pear
pecl install pecl_http
F00x
  • 124
  • 6