Can I Ignore PHP Version Requirements for Pear Package Install - php

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

Related

Composer update: The requested PHP extension ext-http missing

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

Installing OAuth PECL package on PHP 5 on OS X

I'm trying to install the OAuth PECL package, and I'm using PHP 5.
When I run the install command, I get the error below that I must have PHP version 7.0.
Upgrading to PHP 7 is not an option right now, so how do I get the OAuth package installed for PHP 5?
chris$ sudo pecl install oauth
pecl/oauth requires PHP (version >= 7.0.0), installed version is 5.5.29
No valid packages found
install failed
It seems like the dependencies are messed up for Version 2.0.0 of oauth. You can install the previous version like this:
sudo pecl install oauth-1.2.3
I also filed an issue on their GitHub project on your behalf (here), as this seems to be an unintentional bug.
In package.xml, we have:
<required>
<php>
<min>7.0.0</min>
</php>
<!-- ... -->
</required>
Edit
Looks like there's some news from the bug report. Indeed, version 2.0.0 only supports PHP7 and the changelog was unclear. The maintainer of oauth has filed a bug against PECL to install the latest compatible version. So, yes, you're stuck with 1.2.3 and the instructions above are correct.
Edit Again
It looks like PECL won't be fixing this any time soon, so we're stuck installing the specific version :)
Extending upon the already accepted answer
If you are facing compilation errors like I did most probably you are using some application like MAMP.
Unfortunately the latest version of MAMP doesn't include all the components of php.
To install the missing headers download the respective php source code.
Source code for php-5.6.10 can be downloaded from here
After downloading the source code extract it in the php folder under include/php in my case the php folder was located at /Applications/MAMP/bin/php/php5.6.10 so I extracted files under /Applications/MAMP/bin/php/php5.6.10/include/php.
Note:
When you extract the files they are extracted in a folder like php-version in my case it was php-5.6.10 rename it to php and then move it to include folder.
Now go to /Applications/MAMP/bin/php/php5.6.10/include/php and then run ./configure this should build the required header files and then you can install oauth.

How to uninstall PEAR from one installation of PHP and then install it with another existing PHP installation

I have two installations of php on my server. One version of php is 5.2.0 configured with pear, and the other is 5.2.9 configured --without-pear. My server is running Red Hat Enterprise Linux AS release 4 (Nahant Update 9).
I would like to uninstall pear (and also PHPUnit) from php 5.2.0, and then reinstall it as part of the 5.2.9 version of php. The pear installation docs don't really cover this type of a situation, although they do tell Linux users to "consult the documentation for the respective distribution" in the event that they want to install pear with a version of php that was configured --without-pear. I am having trouble finding such documentation, and even if I did, I am not sure how to remove the existing pear installation first.
Here is a partial answer to my own question: After trial and error, I discovered that you can uninstall pear by running this command:
$ sudo pear uninstall pear
I would like to see this added to the official pear docs, since they don't mention uninstalling pear at all.
Use the Command Help
pear help
You'll see the uninstall command listed in the output. :)
Output
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel
...
uninstall Un-install Package
...

Installing PEAR

phpinfo() function shows that my PHP version (5.1.6) is installed --without-pear in the configure command section.
How do I install pear?
The Getting and installing the PEAR package manager page should help you : it gives informations on how to install the PEAR package manager, on both windows, Linux, and Mac.
Basically, if your Linux distribution comes with a PEAP package, you should install it.
For instance, on Ubuntu1, there is a php-pear package ; so, you'd use :
apt-get install php-pear
Else, if it doesn't, with a version of PHP >= 5.3, you should be able to use this :
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar
With PHP 5.1, though, this is not going to work, as phar support has been added in PHP 5.3...
As a sidenote : PHP 5.1 is really outdated !
PHP 5.3 is more than one year and a half old ; even PHP 5.2 is not maintained anymore... maybe you should consider upgrading ?
1It seems you are running some kind of Redhat-based distribution, but I don't have one of those, so I cannot say if there is a PEAR package for it -- there is probably one, though.
--without-pear only means that the PEAR bits were not immediately created when PHP was compiled.
This usually happens when an operating system vendor that provides packages and wants to split off bits and pieces into their own individually installable parts.
Given the age of the PHP you're talking about, you're probably on RHEL or a derivative like CentOS. Check the package manager for a php-pear package.

Install propel_generator 1.2?

I'm trying to install propel_generator version 1.2 (later versions are incompatible with the project I'm working on). I've tried
pear install propel/propel_generator-1.2
But I get the following error:
Failed to download propel/propel_generator, version "1.2",
latest release is version 1.5.2, stability "stable",
use "channel://pear.propelorm.org/propel_generator-1.5.2" to install
install failed
Anybody know how I can install this using Pear?
The short answer is: You can't.
The explanation is:
I took a look at http://pear.propelorm.org/Chiara_PEAR_Server_REST/r/propel_generator/allreleases.xml and the earliest version of propel_generator that is available for install via PEAR from there is version 1.3.0
You could download the v1.2.0 code from http://svn.propelorm.org/tags/1.2.0/ and create a pear package.xml yourself, using their BuildPropelPEARPackageTask.php script, if you really need to.

Categories