【问题标题】:Installing phpDocumentor using PEAR使用 PEAR 安装 phpDocumentor
【发布时间】:2013-12-29 09:37:24
【问题描述】:

http://www.phpdoc.org/http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.quickstart.pkg.htmlhttps://github.com/phpDocumentor/phpDocumentor2的主页上,安装phpDocumentor的说明如下:

pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor

当我这样做时,我发现它已被弃用:

[root@desktop ~]# pear channel-discover pear.phpdoc.org
Adding Channel "pear.phpdoc.org" succeeded
Discovery of channel "pear.phpdoc.org" succeeded
[root@desktop ~]# pear install PhpDocumentor
WARNING: "pear/PhpDocumentor" is deprecated in favor of "phpdoc/phpdocumentor"
Did not download optional dependencies: pear/XML_Beautifier, use --alldeps to download automatically
pear/PhpDocumentor can optionally use package "pear/XML_Beautifier" (version >= 1.1)
downloading PhpDocumentor-1.4.4.tgz ...
Starting to download PhpDocumentor-1.4.4.tgz (1,534,088 bytes)
..............................................................................................................................................................................................................................................................................................................done: 1,534,088 bytes
install ok: channel://pear.php.net/PhpDocumentor-1.4.4
[root@desktop ~]# pear uninstall PhpDocumentor
uninstall ok: channel://pear.php.net/PhpDocumentor-1.4.4

根据http://www.phpdoc.org/docs/latest/for-users/installation/using-pear.html#requirements,指令为:

$ pear install phpdoc/phpDocumentor-beta

使用 PEAR 安装 phpDocumentor 的首选方式是什么?

【问题讨论】:

  • 当你运行pear install phpdoc/phpdocumentor时会发生什么(注意小的d)???
  • 我先试用了测试版,好像还可以。然后尝试了你的建议,我得到了[root@desktop ~]# pear install phpdoc/phpdocumentor phpdoc/phpdocumentor is already installed and is the same as the released version 2.2.0 install failed [root@desktop ~]#
  • 好的,你已经安装好了。那有什么问题呢?
  • 对不起,我在尝试测试版之前发布了这个问题。我认为我最初不应该安装测试版。随意发布一个答案,说明使用测试版或非大写的“d”,我会选择它。

标签: php centos pear phpdoc phpdocumentor2


【解决方案1】:

安装 PEAR

sudo apt-get install php-pear 
sudo pear channel-update pear.php.net 
sudo pear upgrade-all 

安装php文档

sudo pear channel-discover pear.phpdoc.org 
sudo pear remote-list -c phpdoc 
sudo pear config-set data_dir /var/www 
sudo pear install --alldeps PhpDocumentor 
sudo pear install phpdoc/phpDocumentor 
sudo mkdir /var/www/PhpDocumentor-output 
sudo chown www-data /var/www/PhpDocumentor-output 

安装 phpmd

sudo pear channel-discover pear.phpmd.org 
sudo pear remote-list -c phpmd 
sudo pear install phpmd/PHP_PMD 

安装代码嗅探器

sudo pear install PHP_CodeSniffer 

安装phpdepend

sudo pear channel-discover pear.pdepend.org 
sudo pear remote-list -c pdepend 
sudo pear install pdepend/PHP_Depend

检查所有梨包

sudo pear list all 

其他有用的命令

sudo pear upgrade-all 

安装 phpunit 测试

sudo apt-get install phpunit 

【讨论】:

  • 不过,重要的信息应该是pear install --alldeps phpdoc/phpdocumentor
  • Centos 使用 yum 而不是 apt-get。而且你真的不需要所有这些来安装 phpDocumentor。您只需要 pear channel-discover pear.phpdoc.orgpear install phpdoc/phpDocumentor 行 - 除非您确实想要更改默认数据目录、安装可选依赖项并设置输出目录。
【解决方案2】:

我认为您收到“已弃用”消息的实际原因是您运行了 --

pear install phpdocumentor

不包括“phpdoc/”的服务器别名——pear install phpdoc/phpdocumentor

没有别名意味着使用了pear/的默认别名,因此pear install pear/phpdocumentor

这就是它为您提供由 PEAR 托管的 1.x 版本的原因。请注意,在您的输出中:

[root@desktop ~]# pear install PhpDocumentor
WARNING: "pear/PhpDocumentor" is deprecated in favor of "phpdoc/phpdocumentor"

要获得托管在 phpdoc.org 的 2.x 版本,您必须使用 phpdoc/ 别名 -- pear install phpdoc/phpdocumentor

大写的 D 无关紧要,-beta 无关紧要。

【讨论】:

【解决方案3】:

关于错误信息,我认为 PhpDocumentor 应该由以下人员安装:

pear install phpdoc/phpdocumentor

(注意小d)。

【讨论】:

  • 发表评论后,我看到了 amarjit sngh 的回答。如果可行,我可能会选择那个。再次为混乱感到抱歉。谢谢
  • 在我的系统上,它似乎不区分大小写。问题是 OP 是从默认频道安装的。
猜你喜欢
  • 1970-01-01
  • 2013-12-09
  • 1970-01-01
  • 1970-01-01
  • 2013-11-03
  • 2011-08-25
  • 1970-01-01
  • 1970-01-01
  • 2012-11-27
相关资源
最近更新 更多