Matti VM
Matti VM

Reputation: 1211

Composer update: The requested PHP extension ext-http missing

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

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!

Upvotes: 39

Views: 123470

Answers (12)

  demoneno4ec
demoneno4ec

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

Upvotes: 0

Maxime Rainville
Maxime Rainville

Reputation: 2049

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.

Upvotes: 0

saber tabatabaee yazdi
saber tabatabaee yazdi

Reputation: 4959

if you have xamp like me:

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

//or

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

Upvotes: 2

Matti VM
Matti VM

Reputation: 1211

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

Upvotes: 40

VuVanLy
VuVanLy

Reputation: 79

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.

Upvotes: 2

F00x
F00x

Reputation: 124

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

sudo apt install php-pear
pecl install pecl_http

Upvotes: 0

sh6210
sh6210

Reputation: 4540

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

sudo apt install php-http

Upvotes: 28

Volodymyr Horiainov
Volodymyr Horiainov

Reputation: 36

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

Upvotes: 0

Ruslan Skaldin
Ruslan Skaldin

Reputation: 1101

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

Upvotes: 3

Martin Zeitler
Martin Zeitler

Reputation: 76859

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

Upvotes: 3

Michael M.
Michael M.

Reputation: 71

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

Upvotes: 0

Anthony Harley
Anthony Harley

Reputation: 1437

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.

Upvotes: 1

Related Questions