Aug
30
第一步:安装PEAR,具体安装过程请移步:http://www.zhanghaijun.com/post/952/
第二部:PHPUnit,可参考官方文档,http://phpunit.de/manual/3.7/zh_cn/installation.html
安装:
打开windows 命令行窗口,进入php的目录,本文php目录:D:\wwwroot\php-5.5.16-Win32
输入:
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
开始安装

安装完成你可以看见php目录里面有phpunit和phpunit.bat两个文件了
输入 phpunit --version 可以查看phpunit的版本
D:\wwwroot\php-5.5.16-Win32>phpunit --version
PHPUnit 4.0.17 by Sebastian Bergmann.
You have installed PHPUnit via PEAR. This installation method is no longer
supported and http://pear.phpunit.de/ will be shut down no later than
December, 31 2014.
Please read http://phpunit.de/manual/current/en/installation.html and
learn how to use PHPUnit from a PHAR or install it via Composer.
不过根据上面的内容看,官方2014年12月31号开始就不再支持这种安装方式了。
根据自己的需要安装其他组建包:
pear install phpunit/PHP_Invoker
pear install phpunit/DbUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHPUnit_Story
pear install phpunit/PHPUnit_SkeletonGenerator
pear install phpunit/PHPUnit_TestListener_DBUS
pear install phpunit/PHPUnit_TestListener_XHProf
pear install phpunit/PHPUnit_TicketListener_Fogbugz
pear install phpunit/PHPUnit_TicketListener_GitHub
pear install phpunit/PHPUnit_TicketListener_GoogleCode
pear install phpunit/PHPUnit_TicketListener_Trac
1:http://phpunit.de/manual/current/en/installation.html
2:http://pear.phpunit.de/
第二部:PHPUnit,可参考官方文档,http://phpunit.de/manual/3.7/zh_cn/installation.html
安装:
打开windows 命令行窗口,进入php的目录,本文php目录:D:\wwwroot\php-5.5.16-Win32
输入:
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
开始安装
安装完成你可以看见php目录里面有phpunit和phpunit.bat两个文件了
输入 phpunit --version 可以查看phpunit的版本
D:\wwwroot\php-5.5.16-Win32>phpunit --version
PHPUnit 4.0.17 by Sebastian Bergmann.
You have installed PHPUnit via PEAR. This installation method is no longer
supported and http://pear.phpunit.de/ will be shut down no later than
December, 31 2014.
Please read http://phpunit.de/manual/current/en/installation.html and
learn how to use PHPUnit from a PHAR or install it via Composer.
不过根据上面的内容看,官方2014年12月31号开始就不再支持这种安装方式了。
根据自己的需要安装其他组建包:
pear install phpunit/PHP_Invoker
pear install phpunit/DbUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHPUnit_Story
pear install phpunit/PHPUnit_SkeletonGenerator
pear install phpunit/PHPUnit_TestListener_DBUS
pear install phpunit/PHPUnit_TestListener_XHProf
pear install phpunit/PHPUnit_TicketListener_Fogbugz
pear install phpunit/PHPUnit_TicketListener_GitHub
pear install phpunit/PHPUnit_TicketListener_GoogleCode
pear install phpunit/PHPUnit_TicketListener_Trac
1:http://phpunit.de/manual/current/en/installation.html
2:http://pear.phpunit.de/
Aug
30
首先到http://windows.php.net/downloads/releases/archives/下载php最新版本,根据你的系统和需要选择线程安全或非线程安全的版本,下载之后解压到你开发环境的php目录,本文php路径:D:\wwwroot\php-5.5.16-Win32
其次因为现在新版的php已经不带go-pear.phar了,所以我们要下载一个,下载地址:http://pear.php.net/go-pear.phar,下载之后放到php的目录,本文的路径是:D:\wwwroot\php-5.5.16-Win32
再次我们要在php的目录下创建一个批处理文件,名称随便取,本文用go-pear.bat,内容为:
@ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 go-pear.phar
pause
保存之后双击go-pear.bat执行,如果提示缺少 msvcr110.dll ,那就是你的系统缺少vc 2012 运行库,需要安装 vcredist_x64.exe 或 vcredist_x86.exe,根据自己的系统下载对应的版本安装即可,下载地址:http://www.microsoft.com/zh-cn/download/details.aspx?id=30679。
接下来我们继续安装过程:

按回车确定

确定没有问题按回车进行安装,输入数字则修改对应项,修改后按回车进行安装。
安装之后php的目录会生成一个名字为PEAR_ENV.reg的注册表文件,双击PEAR_ENV.reg导入注册表。
打开windows的命令行窗口,切换到D盘,cd D:\wwwroot\php-5.5.16-Win32 到php的目录

输入pear -V 就可以查看pear的版本信息了:
D:\wwwroot\php-5.5.16-Win32>pear -V
PEAR Version: 1.9.5
PHP Version: 5.5.16
Zend Engine Version: 2.5.0
Running on: Windows NT WIN-V07MB4H27T1 6.1 build 7600 (Windows Server 2008 R2 Datacenter Edition) AMD64
输入pear list可以查看已安装的包:
D:\wwwroot\php-5.5.16-Win32>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.12 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.5 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.3 stable
如果没有Image_GraphViz和Log包,使用 pear install Log和pear install Image_GraphViz把这两个包安装了。

再次输入pear list 查看已安装的包,应该有以下这些包了:
D:\wwwroot\php-5.5.16-Win32>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.12 stable
Console_Getopt 1.3.1 stable
Image_GraphViz 1.3.0 stable
Log 1.12.8 stable
PEAR 1.9.5 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.3 stable
使用 pear upgrade-all 可以升级所有已安装的包。
其次因为现在新版的php已经不带go-pear.phar了,所以我们要下载一个,下载地址:http://pear.php.net/go-pear.phar,下载之后放到php的目录,本文的路径是:D:\wwwroot\php-5.5.16-Win32
再次我们要在php的目录下创建一个批处理文件,名称随便取,本文用go-pear.bat,内容为:
@ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 go-pear.phar
pause
保存之后双击go-pear.bat执行,如果提示缺少 msvcr110.dll ,那就是你的系统缺少vc 2012 运行库,需要安装 vcredist_x64.exe 或 vcredist_x86.exe,根据自己的系统下载对应的版本安装即可,下载地址:http://www.microsoft.com/zh-cn/download/details.aspx?id=30679。
接下来我们继续安装过程:
按回车确定
确定没有问题按回车进行安装,输入数字则修改对应项,修改后按回车进行安装。
安装之后php的目录会生成一个名字为PEAR_ENV.reg的注册表文件,双击PEAR_ENV.reg导入注册表。
打开windows的命令行窗口,切换到D盘,cd D:\wwwroot\php-5.5.16-Win32 到php的目录
输入pear -V 就可以查看pear的版本信息了:
D:\wwwroot\php-5.5.16-Win32>pear -V
PEAR Version: 1.9.5
PHP Version: 5.5.16
Zend Engine Version: 2.5.0
Running on: Windows NT WIN-V07MB4H27T1 6.1 build 7600 (Windows Server 2008 R2 Datacenter Edition) AMD64
输入pear list可以查看已安装的包:
D:\wwwroot\php-5.5.16-Win32>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.12 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.5 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.3 stable
如果没有Image_GraphViz和Log包,使用 pear install Log和pear install Image_GraphViz把这两个包安装了。
再次输入pear list 查看已安装的包,应该有以下这些包了:
D:\wwwroot\php-5.5.16-Win32>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.12 stable
Console_Getopt 1.3.1 stable
Image_GraphViz 1.3.0 stable
Log 1.12.8 stable
PEAR 1.9.5 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.3 stable
使用 pear upgrade-all 可以升级所有已安装的包。