Pear Fix for “Error: Unable to Unpack”

Recently while trying to install some Pear packages, I received an odd “Error: Unable to Unpack” message. A search for this error message found a lot of complaining people and not a lot of answers. I finally figured out the cause and the fix for this common Pear problem.

Here are combined transcripts of my session. Notice the various errors this problem gives. The different download lengths clued me into the problem. After the transcript, I give the problem and the ultimate solution.

Transcript:


C:\>pear install symfony/symfony-1.0.17
downloading symfony-1.0.17.tgz …
Starting to download symfony-1.0.17.tgz (1,913,192 bytes)
………………………………………….done: 249,532 bytes
ERROR: unable to unpack C:\DOCUME~1\TECHRX\LOCALS~1\Temp\1\pear\download\symfony-1.0.17.tgz

C:\>pear install symfony/symfony-1.0.17
downloading symfony-1.0.17.tgz …
Starting to download symfony-1.0.17.tgz (1,913,192 bytes)
…..done: 10,792 bytes
could not extract the package.xml file from “C:\DOCUME~1\TECHRX\LOCALS~1\Temp\1\pear\download\symfony-1.0.17.tgz” Extr
ed file C:/DOCUME~1/TECHRX/LOCALS~1/Temp/1/pear/download/package.xml does not have the correct file size ‘55462’ (2528
expected). Archive may be corrupted.
Download of “symfony/symfony” succeeded, but it is not a valid package archive
Error: cannot download “symfony/symfony”
Download failed
install failed

C:\>pear install symfony/symfony-1.0.17
downloading symfony-1.0.17.tgz …
Starting to download symfony-1.0.17.tgz (1,913,192 bytes)
……….done: 37,012 bytes
could not extract the package.xml file from “C:\DOCUME~1\TECHRX\LOCALS~1\Temp\1\pear\download\symfony-1.0.17.tgz” Extr
ed file C:/DOCUME~1/TECHRX/LOCALS~1/Temp/1/pear/download/package.xml does not have the correct file size ‘220527’ (252
expected). Archive may be corrupted.
Download of “symfony/symfony” succeeded, but it is not a valid package archive

C:\>pear install symfony/symfony-1.0.17
downloading symfony-1.0.17.tgz …
Starting to download symfony-1.0.17.tgz (1,913,192 bytes)
……………………………………………………..done: 1,913,192 bytes
install ok: channel://pear.symfony-project.com/symfony-1.0.17

Conclusion:

The different lengths of the downloaded file suggested to me that this was a network issue. I confirmed this when my direct downloads via http gave horrible download speeds:

pear fail

My solution was to wait 24hrs until whatever glitch in the pipes between me and the package were fixed. Alternatively, you could download the package through some other method and manually install through pear’s install function.

Other than network problems, the lack of write access or storage space within your temp directory could also theoretically cause this problem.

 

About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.

  • Flight

    thanks it is really good tip

  • Anonymous

    really good tip … for these kind of errors first check for permissions, then network problem

    explore interesting techtips in my arena
    http://infopediaonlinehere.blogspot.com/

  • Hello,
    the web frontend not write correct paths to pear.ini
    ig phph setting is magic_quotes_gpc = On
    its doubles all slashes “” in paths to “\” is it a bug ?
    Than the packages for example can be unpacked (wrong paths ?)

    “unable to unpack” Message when installing packages

    Thank you.
    http://pear.php.net/bugs/bug.php?id=18212