问题
During a pecl package installation, i got the error,
Download of "pecl/pecl_http" succeeded, but it is not a valid package archive
Error: cannot download "pecl/pecl_http"
This error is coming for all the packages. So i tried the solution given here, http://cweiske.de/tagebuch/pear-php-5.5.htm. But it is not working. And i don't have any other clue on this. It would be really helpful if someone explains what exactly the problem is. Please help.
回答1:
This bug commonly affects systems upgraded to Ubuntu 14.04 LTS from Ubuntu 12.04 LTS.
There is a workaround for php5-5.5.9 as commented by kolAflash on Launchpad.
The workaround contains a small typo (tar
instead of tgz
), so I provide a working solution:
# First run pear to download the packages. It will probably put the packages into
# /build/buildd/php5-5.5.9+dfsg/pear-build-download/
# but it can't install them.
$ pear upgrade
# Un-Gzip the downloaded packages.
$ gunzip /build/buildd/php5-5.5.9+dfsg/pear-build-download/*.tgz
# Now pear should be able to work with the pure tar-files.
$ pear upgrade /build/buildd/php5-5.5.9+dfsg/pear-build-download/*.tar
All credit for this workaround obviously goes to kolAflash.
回答2:
Seems that Pear can't install from tgz archive. You have to explicitly request uncompressed files when downloading with -Z, --nocompress option.
So, try sudo pear install -Z
package
回答3:
The best solution for this is to upgrade PEAR's Archive package, which the pear installer uses, and after that you won't need to explicitly request uncompressed files when installing new, or upgrading existing, packages.
$ sudo pear upgrade -Z Archive_Tar
You should not have to do this for any other package so long as you do it for Archive_Tar first.
This problem happens because Ubuntu changed the pack/unpack format strings a bit to align them to the Perl behavior, which breaks backwards compatibility. PEAR fixed this in successive versions of Archive_Tar (Ubuntu kept making those changes in each successive version of PHP...). And so the pear installer requires a later version of Archive_Tar than 1.3.11 - details are at https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1434099.
You will need to do this after each 'Software Upgrade' affecting PHP that Ubuntu proffers, as the upgrade rolls back the version of Archive_Tar you have installed locally. It also rolls back the Console_Getopt, XML_Util and PEAR packages.
回答4:
I had this problem and eventually got Archive_Tar to update by
gunzip *.tgz
tar -xvf Archive_Tar-1.4.2.tar
mv package.xml Archive_Tar-1.4.2
cd Archive_Tar-1.4.2
pear upgrade package.xml
After that worked, pear upgrade worked for me. I previously had Archive_Tar-1.3.10 and was upgrading to 1.4.2
回答5:
Look like this is a bug and is tied with some specific version of software piece. Quick googling found a link to cpanel forums with such problem as old as 2011, and quite fresh https://bugs.php.net/bug.php?id=67075 . Consider changing php version/switching from 32-bit system (for example, it is reproducible with 32-bit fresh new Ubuntu 14.04 and not reproducible with 64-bit version of the same).
来源:https://stackoverflow.com/questions/23762141/pear-succeeded-but-it-is-not-a-valid-package