Windows - PHPDocs 无法通过 Pear 安装

Windows - PHPDocs unable to install through Pear

当运行安装phpdocs的两条命令:

pear channel-discover pear.phpdoc.org pear install

phpdoc/phpDocumentor

我在下面收到这个错误,说我无法解压下面的 tgz 文件。

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

看起来 PEAR 安装程序由于某种原因无法解压缩下载的 .tgz,例如,可能没有编译 zlib 扩展。

作为变通方法,您可以指定 PEAR 改为请求未压缩的包文件:

pear install --nocompress phpdoc/phpDocumentor

遇到了同样的问题,结果是 2.8.2 的包有问题,因为 pear install phpdoc/PhpDocumentor-2.8.1 工作得很好

我尝试了@kguest 的回答 ->

  pear install --nocompress phpdoc/phpDocumentor

运气不好。所以我尝试了 "upgrading"

 pear upgrade C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar

再次,没有运气。然后我构建自己的解决方案:

1) 从 PEAR 临时目录中提取文件:

  C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar

2) 将最近提取的文件重新打包为 TAR(我使用的是 7zip)。

3) 重新尝试升级,但从新创建的 TAR:

  C:\temp\phpDocumentor.tar

然后才起作用。

我对 phpDocumentor 2.8.5 的解决方案是

  1. https://github.com/phpDocumentor/phpDocumentor2/releases

  2. 解压缩存档 phpDocumentor-2.8.5.tgz manulay(例如使用 7zip)您将获得 phpDocumentor-2.8 .5.tar,也解压它,你会得到文件夹phpDocumentor-2.8.5和文件package.xml

  3. 编辑存档package.xml并将文本template:init更改为template_init(第2036行)其实是一条路径(信息来源:https://github.com/phpDocumentor/phpDocumentor2/issues/1608

  4. 压缩文件夹phpDocumentor-2.8.5和文件package.xml(例如phpdoc285.tar)

  5. 安装存档phpdoc285.tar

    pear install --nocompress phpdoc285.tar

经过几个小时尝试其他人的解决方案后,我终于可以使用 phpDocumentor 2.9.0

您可以从以下网址下载:

https://github.com/phpDocumentor/phpDocumentor2/releases

然后使用 pear 安装 "filepath\phpDocumentor-2.9.0.tgz"

此问题特别针对 windows os,以避免错误:

ERROR: unable to unpack ...

在启动 phpdoc 命令之前安装 7-zip