问题
When running the two commands to install phpdocs:
pear channel-discover pear.phpdoc.org pear install
phpdoc/phpDocumentor
I get this error below saying I am unable to unpack a tgz file below.
C:\wamp\bin\php\php5.5.12\pear>pear channel-discover pear.phpdoc.org
C:\wamp\bin\php\php5.5.12\pear>pear install phpdoc/phpDocumentor
downloading phpDocumentor-2.8.2.tgz ...
Starting to download phpDocumentor-2.8.2.tgz (16,246,834 bytes)
................................................................................
................................................................................
................................................................................
..........................done: 16,246,834 bytes
ERROR: unable to unpack C:\Users\me\AppData\Local\Temp\pear\download\p
hpDocumentor-2.8.2.tgz
回答1:
It looks like the PEAR installer was unable to uncompress the downloaded .tgz for some reason, perhaps the zlib extension wasn't compiled in, for example.
As a work-around, you can specify that PEAR should request the uncompressed package file instead:
pear install --nocompress phpdoc/phpDocumentor
回答2:
Faced the same problem, turns out package for 2.8.2 has issues, because
pear install phpdoc/PhpDocumentor-2.8.1
worked just fine
回答3:
I tried @kguest answer ->
pear install --nocompress phpdoc/phpDocumentor
with no luck. So I tried "upgrading"
pear upgrade C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar
Again, with no luck. Then I build my own solution:
1) Extract the files from the PEAR temp directory:
C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar
2) Repack the recently extracted files as TAR (I used 7zip).
3) Reattempt the upgrade but from the newly created TAR:
C:\temp\phpDocumentor.tar
And only THEN it worked.
回答4:
My solution for phpDocumentor 2.8.5 was
Download the tarball archive from https://github.com/phpDocumentor/phpDocumentor2/releases
Uncompress the archive phpDocumentor-2.8.5.tgz manulay (e.g. with 7zip) You will get the phpDocumentor-2.8.5.tar, uncompress it too and you will get the folder phpDocumentor-2.8.5 and the file package.xml
Edit the archive package.xml and change the text template:init to template_init (line 2036) in fact it is a path (Info source: https://github.com/phpDocumentor/phpDocumentor2/issues/1608)
Compress the folder phpDocumentor-2.8.5 and the file package.xml (e.g. phpdoc285.tar)
Install the archive phpdoc285.tar
pear install --nocompress phpdoc285.tar
回答5:
After a few hours of trying other people's solutions I've finally got it working phpDocumentor 2.9.0
You can download it from:
https://github.com/phpDocumentor/phpDocumentor2/releases
then use pear install "filepath\phpDocumentor-2.9.0.tgz"
回答6:
This issue is especially on windows os, to avoid the error :
ERROR: unable to unpack ...
install 7-zip before you launch the phpdoc command
来源:https://stackoverflow.com/questions/30358699/windows-phpdocs-unable-to-install-through-pear