39

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!

4
  • 2
    stackoverflow.com/questions/22332031/… Commented Feb 13, 2019 at 17:00
  • Could you post the contents of your composer.json? Commented Feb 13, 2019 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. Commented Feb 14, 2019 at 9: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? Commented Jul 31, 2019 at 19:43

12 Answers 12

40

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

Sign up to request clarification or add additional context in comments.

10 Comments

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?
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.
This "answer" should be downvoted 23 times, not upvoted. This "answer" doesn't solve the problem.
@emix don't be hard on him, he just hiding the problem not even trying to fix it
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
|
29

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

sudo apt install php-http 

3 Comments

How this should be an answer as OP operating system is Windows ?
I thought the whole point of a package / dependency manager like composer was to be independent of the OS and its libraries, so why would I install an OS library here, which may or may not be available in my docker container, my buddy's system, or for whoever runs my code?
php-http is an extension for PHP, not a dependency handled by composer. You can't neither install PHP from Composer. When PHP and the extensions you need are installed in the OS, then you can use Composer to download some PHP dependencies written in PHP.
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 

1 Comment

pecl install pecl_http did solves my problem Thanks
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 

2 Comments

You know on windows how could get this?
OP operating system is Windows
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.

Comments

2

if you have xamp like me:

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

//or

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

1 Comment

This isn't an answer, it's a workaround.
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.

Comments

1

Running php -m will list all currently enabled modules.

If you look at the top and see this warning:

PHP Warning: Unable to load module "http" because the required module "raphf" is not loaded

You just need to install ext-raphf.

If you are using Ubuntu, just run

sudo apt install php-raphf 

Then run php -m until there are no errors or warnings above.

After solving all warnings, you can continue installing dependencies.

In my case, on php7.4 I needed to install the following packages

sudo apt install php7.4-raphf sudo apt install php7.4-propro 

Comments

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

Comments

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

Comments

0

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

sudo apt install php-pear pecl install pecl_http 

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.