windows 下的pear 安装及pear 下的phpDocument安装配置!

环境要求:

Windows + APMServ5.2.6/PHP5以上

安装步骤:

1、Windows的开始 -> 运行 ->cmd

2、安装命令

d:
cd D:\APMServ5.2.6\PHP
D:\APMServ5.2.6\PHP>go-pear.bat

 Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :  敲击回车键 (Enter)

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type ‘all’ to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : D:\APMServ5.2.6\PHP
 2. Temporary directory for processing            : D:\APMServ5.2.6\PHP\tmp
 3. Temporary directory for downloads             : D:\APMServ5.2.6\PHP\tmp
 4. Binaries directory                            : D:\APMServ5.2.6\PHP
 5. PHP code directory ($php_dir)                 : D:\APMServ5.2.6\PHP\pear
 6. Documentation directory                       : D:\APMServ5.2.6\PHP\docs
 7. Data directory                                : D:\APMServ5.2.6\PHP\data
 8. User-modifiable configuration files directory : D:\APMServ5.2.6\PHP\cfg
 9. Public Web Files directory                    : D:\APMServ5.2.6\PHP\www
10. Tests directory                               : D:\APMServ5.2.6\PHP\tests
11. Name of configuration file                    : D:\APMServ5.2.6\PHP\pear.ini

12. Path to CLI php.exe                           : D:\APMServ5.2.6\PHP\.

1-12, ‘all’ or Enter to continue:   输入all

Installation base ($prefix) [D:\APMServ5.2.6\PHP] :
Temporary directory for processing [$prefix\tmp] :
Temporary directory for downloads [$prefix\tmp] :
Binaries directory [$prefix] :
PHP code directory ($php_dir) [$prefix\pear] :
Documentation directory [$prefix\docs] :
Data directory [$prefix\data] :
User-modifiable configuration files directory [$prefix\cfg] :
Public Web Files directory [$prefix\www] :
Tests directory [$prefix\tests] :
Name of configuration file [D:\APMServ5.2.6\PHP\pear.ini] :
Path to CLI php.exe [D:\APMServ5.2.6\PHP\.] :

一直回车,即可

此时D:\APMServ5.2.6\PHP 会多出一个文件 pws-php5isapi.reg ,双击,确定,关闭控制台窗口,新打开一个cmd。

D:\APMServ5.2.6\PHP>pear -V
PEAR Version: 1.7.1
PHP Version: 5.2.6
Zend Engine Version: 2.2.0
Running on: Windows NT 5EC44E99C71645F 5.1 build 2600

ok,安装成功,不过别高兴的太早了,还有升级呢…不然无法安装后续的PHPUnit!

 

安装PHPUnit

D:\APMServ5.2.6\PHP>pear list

INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE          VERSION STATE
Archive_Tar      1.3.3   stable
Console_Getopt   1.2.3   stable
Image_GraphViz   1.2.1   stable
Log              1.11.5  stable
PEAR             1.9.0   stable
Structures_Graph 1.0.3   stable
XML_Util         1.2.1   stable

没有以上安装包的请你先安装,比如你没有安装Image_GraphViz 和Log,请输入以下指令:

D:\APMServ5.2.6\PHP>pear install Image_GraphViz
D:\APMServ5.2.6\PHP>pear install Log

安装成功后,再输入以下指令:

D:\APMServ5.2.6\PHP>pear upgrade-all

Will upgrade channel://pear.php.net/archive_tar
Will upgrade channel://pear.php.net/structures_graph
Will upgrade channel://pear.php.net/pear
downloading Archive_Tar-1.3.3.tgz …
Starting to download Archive_Tar-1.3.3.tgz (18,119 bytes)
……done: 18,119 bytes
downloading Structures_Graph-1.0.3.tgz …
Starting to download Structures_Graph-1.0.3.tgz (30,191 bytes)
…done: 30,191 bytes
downloading PEAR-1.9.0.tgz …
Starting to download PEAR-1.9.0.tgz (291,634 bytes)
…done: 291,634 bytes
upgrade-all ok: channel://pear.php.net/Archive_Tar-1.3.3
upgrade-all ok: channel://pear.php.net/Structures_Graph-1.0.3
upgrade-all ok: channel://pear.php.net/PEAR-1.9.0
PEAR: Optional feature webinstaller available (PEAR’s web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR’s PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR’s PHP-GTK2-based installer)

PEAR: To install optional features use “pear install pear/PEAR#featurename”

好的,如果你到达这一步,恭喜你成功即将离你不远。

D:\APMServ5.2.6\PHP>pear channel-discover pear.phpunit.de
D:\APMServ5.2.6\PHP>pear install phpunit/PHPUnit

我在执行上面第二句安装失败:

Unknown remote channel: pear.symfony-project.com
Did not download optional dependencies: channel://pear.symfony-project.com/YAML,
 use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "channel://pear.symfony-project.com/Y
AML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit requires PHP extension "xdebug" (version >= 2.0.5), installed ve
rsion is 2.0.4
No valid packages found
install failed

 

原因是channel不通,还有xdebug版本过低,于是增加下面代码

D:\xx\PHP>pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded

 

D:\xx\PHP>pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded

再到 http://xdebug.org/download.php 下载最新的 xdebug 仍到 ext 文件夹中,重启apache,完成xdebug的升级。

之后在执行安装phpunit, 成功~

 

 

 

如果这两个都没有出错的话,D:\APMServ5.2.6\PHP目录下会出现以下四个文件:

phpunit.bat
phpunit
dbunit.bat
dbunit

好了,检测安装是否成功。

校验安装

D:\APMServ5.2.6\PHP>pear -V

PEAR Version: 1.9.0
PHP Version: 5.2.6
Zend Engine Version: 2.2.0
Running on: Windows NT 5EC44E99C71645F 5.1 build 2600

D:\APMServ5.2.6\PHP>phpunit –version

PHPUnit 3.4.5 by Sebastian Bergmann.

注意如果不成功的话,请使用

d:
cd D:\APMServ5.2.6\PHP
D:\APMServ5.2.6\PHP>phpunit.bat

另外为了避免每次这样启动,建议你讲D:\APMServ5.2.6\PHP\phpunit.bat 加入环境变量PATH,dbunit亦如此。

Pear 下安装phpDocument

另外为了避免每次这样启动,建议你讲D:\APMServ5.2.6\PHP\phpunit.bat 加入环境变量PATH,dbunit亦如此。

  1. 然后开始>执行>输入CMD打开CMD命令窗口, 然后进入你的PHP安装文件夹, 输入以下命令: pear install –o PhpDocumentor

即可下载PhpDocument. 完成后, 你可以在PHP安装目录下的PEAR目录中发现多了一个PhpDocument文件夹.

  1. 完成之后就可以使用CMD命令执行生成帮助文档啦. 具体命令如下:

     

    下载wordpress源文件,解压到phpDocumentor里,新建一个wp_parsed文件夹存放中间文件。
    在命令行执行:php phpdoc -o CHM:default:default -d wordpress -t wp_parsed
    完成后,用HTML Help Workshop打开wp_parsed里的.hhp文件,在左边”Project”选项卡中选第一个按钮”Change Project Options”,修改”General”中的”Title”,勾选”Compiler”选项卡里”Compile full-text search information”,然后编译就可以了。

 

  1. 如果你想生成CHM文件之类或其它格式的话, 把HTML:Smarty:PHP修改成对应的, 目前PhpDocument 1.4.3可以有以下几种格式:

    windows 下的pear 安装及pear 下的phpDocument安装配置!

  2. 如果你系生成CHM的话, 你需要使用其它软件进行编译. 目前我是使用微软提供的HTML Help Workshop. 因为懒得下载, 所有就直接使用360的软件管家搜索下载安装算啦了.完成后. 执行程序, 界面如下:

    windows 下的pear 安装及pear 下的phpDocument安装配置!

    具体使用方法[略… ^^].

     

    最后发一个为自己库文件生成的HTML版帮助文件截图^^

    windows 下的pear 安装及pear 下的phpDocument安装配置!

     

    关于中文注释出现乱码的问题, 可以使用DreamWeaver搜索phpdocument模板文件中的iso-8859-1字符, 并替换成utf-8. 这些文件所在位置在PHP安装目录下的data目录中. 例如我的是E:\PHP5\data\PhpDocumentor\

众位本人时间原因整理有些乱!大家应该能看明白吧?

你可能感兴趣的:(document)