无法全局使用phpdoc命令

时间:2014-10-10 08:35:54

标签: windows environment-variables phpdoc

我根据使用Composer在同一目录中的D:\xampp\php\pear\phpDocumentor在目录composer.json中安装了phpDocumentor 2.*。 它安装了phpDocumentor所需的所有依赖项。

{
    "require-dev": {
        "phpdocumentor/phpdocumentor": "2.*"
    }
}

当我通过Windows命令行导航到目录D:\xampp\php\pear\phpDocumentor\vendor\bin并运行phpdoc时,没问题。

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\TPP>cd\

C:\>d:

D:\>cd xampp\php\pear\phpDocumentor\vendor\bin

D:\xampp\php\pear\phpDocumentor\vendor\bin>phpdoc --version
phpDocumentor version 2.7.0

D:\xampp\php\pear\phpDocumentor\vendor\bin>

我在Windows环境变量中添加了路径D:\xampp\php\pear\phpDocumentor\vendor\bin,但我无法全局访问phpdoc

C:\Users\TPP>phpdoc
******************************************************************************
* PhpDocument Command-Line  Starter
*
* phpDocumentor is a JavaDoc-like automatic documentation generator for PHP
* written in PHP. It is the most versatile tool for documenting PHP.
*
* This batch-file will try to run the phpDocumentor using the command-line
* version of PHP4. NOTE: It will not run with the PHP ISAPI module!
* Please update the path in this batch-file to your PHP-CLI.
*
* Tip: o Grab a copy of one of the ini-files in the user/ dir of the
*        phpDocumentor and modify the settings there.
*      o To see the command line options type  phpdoc -h
*
* @version 1.3  2003-06-28
* @author Sam Blum sam@blueshoes.org
* @Copyright Free Software released under the GNU/GPL license
*
* This SW was contributed by BlueShoes www.blueshoes.org "The PHP Framework"
******************************************************************************
------------------------------------------------------------------------------
Select Ini-File [default is phpDocumentor.ini]
------------------------------------------------------------------------------
# 0: phpDocumentor.ini
Type a number and press Enter[0]:0
Starting: "D:\xampp\php\.\php.exe" "D:\xampp\php\phpdoc" -c "phpDocumentor.ini"

Could not open input file: \xampp\php\phpdoc
Press any key to continue . . .

C:\Users\TPP>

它似乎与D:\xampp\php\phpdoc冲突,可能与PHP安装有关。我在PHP 5.4.4中使用XAMPP 1.8.0

如何根据我的新安装使phpdoc全局运行?

2 个答案:

答案 0 :(得分:0)

这是phpDocumentor 1.x包含在XAMPP附带的其他PEAR包中。最好的选择是使用XAMPP的PEAR可执行文件卸载phpDocumentor 之前使用Composer来安装phpDocumentor 2.x.卸载1.x的任何其他方法都可能会留下一些旧文件。

答案 1 :(得分:0)

安装 PHP Documentor

C:\> composer global require phpdocumentor/phpdocumentor

确定您组成者的全局路径

C:\> composer global config home

将全局作曲家库设置为您的系统环境路径

C:\Users\Admin\AppData\Roaming\Composer\vendor\bin

确认设置

C:\> phpdoc --version