Composer update: The requested PHP extension ext-http missing - php

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!

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

in my case i'm using ubuntu, hope this solve the problem.
sudo apt install php-http

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

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

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

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.

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.

Have you already tried the options here for similar issues?
Composer: The requested PHP extension ext-intl * is missing from your system
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).

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

In my case, the combination worked (Ubuntu php7.4)
sudo apt install php-pear
pecl install pecl_http

Related

How to install GMP PHP package on Mac

I need to install web-token/jwt-framework on MacOS High Sierra using composer. So, I use command composer require web-token/jwt-framework. When I do that, I get this error message in terminal:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- web-token/jwt-framework v1.3.8 requires ext-gmp * -> the requested PHP extension gmp is missing from your system.
I tried to go to https://gmplib.org/#DOWNLOAD but there is nothing on how to actually install gmp, and thus incorporating it into my PHP. I did not try out setting it up in PHP.INI because I haven't yet did anything to install it. Any advice?

Laravel project creation, Your requirements could not be resolved to an installable set of packages

I'm trying to create a project using a composer. I use the following command. My folder consist of another project but in a separate folder.
composer create-project --prefer-dist laravel/laravel blog
The error I get is,
Your requirements could not be resolved to an installable set of packages.
Some answers in Stackoverflow says to upgrade the PHP. But in my case it's already updated to newest version. php -v says,
Is there any solution? Any suggestion is warmly welcome.
Edit: I installed the php mbstring but I get the same error.
If you're running PHP 5
sudo apt-get install php5-mbstring
If you're running PHP 7
sudo apt-get install php7.0-mbstring
Also, read Laravel's requirements: https://laravel.com/docs/5.4/installation
There may be other dependencies you haven't installed:
PHP >= 5.6.4
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension

PHP pcntl module installation

Problems
d11wtq/boris v1.0.10 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
d11wtq/boris v1.0.10 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
Installation request for d11wtq/boris v1.0.10 -> satisfiable by d11wtq/boris[v1.0.10].
When I run command: composer install it creating error.
And also how to install extension on php.init.
extension=php_curl.dll
I know this is an old one, but I ran into the same problem and with this switch just solved it:
composer install --ignore-platform-reqs
I fixed this by running composer update before install.
Solved my problem updating and ignoring requested PHP extensions:
composer update --ignore-platform-reqs
http://php.net/manual/en/pcntl.installation.php
Process Control support in PHP is not enabled by default. You have to
compile the CGI or CLI version of PHP with --enable-pcntl
configuration option when compiling PHP to enable Process Control
support.
Note:
Currently, this module will not function on non-Unix platforms (Windows).
I had the same problem on my system (OpenSUSE, PHP7). Simply installing php7-pcntl solved my problem.
We can resolve this issue by following way.
Your options are as follows:
Install the required extensions (best option)
Run composer with the --ignore-platform-reqs flag (very hacky) like composer update --ignore-platform-reqs
Upgrade to Laravel 5 (we no longer user boris for the tinker command)

Trying to install PHP_Depend

I'm trying to install PHP_Depend as here below but I'm getting that error you can see..
javier#javier-mbp:/var/www$ pear channel-discover pear.pdepend.org
Channel "pear.pdepend.org" is already initialized
javier#javier-mbp:/var/www$ pear remote-list -c pdepend
Channel pdepend Available packages:
===================================
Package Version
PHP_CodeSniffer_Standards_PDepend2 -n/a-
PHP_Depend 0.10.6
PHP_Depend_Log_Arbit 1.0.0
staticReflection -n/a-
javier#javier-mbp:/var/www$ pear install pdepend/PHP_Depend
No releases available for package "pear.pdepend.org/PHP_Depend"
install failed
Any help?
Javi
You no longer have to install the -beta package (as shown here - http://pear.pdepend.org/).
If you're still getting this error, you may have an issue with your pear cache.
Try running:
pear clear-cache
And then try installing again.
Another thing I'd like to make mention of: PHP_Depend is now available on Packagist as 'pdepend' via Composer: http://pdepend.org/news/pdepend-1.1.0-released.html
As stated in http://pdepend.org/documentation/handbook/installation/pear-installer.html:
$ pear install pdepend/PHP_Depend-beta
Note the "beta" in it. By default, the pear installer only installs software marked as stable, which phpdepend is not.

Can I Ignore PHP Version Requirements for Pear Package Install

I'm trying to install a couple of pear packages but have an issue with the version of PHP I'm running. Firstly I get:
sudo pear install phix/Autoloader
Failed to download phix/Autoloader, latest release is version 3.0.0, but it requires PHP version "5.3.0", use "channel://pear.phix-project.org/Autoloader-3.0.0" to install
Cannot initialize 'channel://pear.phix-project.org/Autoloader', invalid or missing package file
Package "channel://pear.phix-project.org/Autoloader" is not valid
install failed
I then try and install as follows:
sudo pear install channel://pear.phix-project.org/Autoloader-3.0.0
phix/Autoloader requires PHP (version >= 5.3.0), installed version is 5.2.6-1+lenny13
No valid packages found
install failed
Would I be correct in assuming the error is related to the version of PHP I'm running? If so, is there a way of getting the pear install to ignore the PHP version requirements?
Thanks
Even if you bring PEAR to ignore the version, you cannot use the packages, because the requirements are not fulfilled. There are really good reasons, why the package maintainers set the requirements.
Thus: No, you can't.
Please take a look into
pear help install
This should list you all available options. As written in my comment above, I don't think it makes sense, but you can just try harder to make pear installing the package anyway. The package then might just not work in the end, but well, that are "just" requirements you'd like to ignore anyway, so go ahead ;)

Categories