`
phpseyo
  • 浏览: 157296 次
  • 性别: Icon_minigender_1
  • 来自: 广西
社区版块
存档分类
最新评论

Windows下安装PEAR, PHPUnit成功

    博客分类:
  • PHP
阅读更多

环境要求:

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亦如此。

 

 

转载自LixiPHP
分享到:
评论

相关推荐

    安装pear和phpunit

    安装pear,phpunit,所有的错误,帮助你解决难题。

    PHP5.4.3下安装PEAR&PHPUnit;&phpDoc2;

    PHP5.4.3 下安装PEAR、PHPUnit、phpDoc2...

    windows下安装pear及phpunit(注意配置好php命令行环境)

    windows下安装pear及phpunit(注意配置好php命令行环境),需要的朋友可以参考下。

    pear及phpUnit的安装教程

    详细的安装教程 自己应经测试的出来的 放心下载

    Windows 下的 PHP-PEAR 安装方法

    您可能感兴趣的文章:PHP Pear 安装及使用windows下安装pear及phpunit(注意配置好php命令行环境)PHP 5.0 Pear安装方法PHP pear安装配置教程pear包安装phpunit的方法windows下安装PEAR php5.3.1下解决出错的方法...

    pear包安装phpunit的方法

    PHPUnit可以通过PHP扩展和程序库(PEAE)获得。 PEAR是可重用PHP组件的框架和分发系统。 安装PHPUnit可以通过PEAR安装程序命令... 尽管使用PEAR安装程序是PHPUnit唯一支持的安装方法,但你还是可以手工安装。 要手工

    php安装xdebug/php安装pear/phpunit详解步骤(图)

    PHP环境中安装pear、phpunit以及xdebug全攻略,大家参考使用吧

    Windows下安装PHP单元测试环境PHPUnit图文教程

    主要介绍了Windows下安装PHP单元测试环境PHPUnit图文教程,按照本文操作即可在Windows下安装成功PHPUnit,需要的朋友可以参考下

    phpunit windows

    版本很老,留存备份。对windows环境错了容错处理。不要下载,请绕行

    phpunit 3.67 最新版

    pear install phpunit/PHPUnit 方法二 :手动安装 1 从http://pear.phpunit.de/get/下载软件包并解压 2 把解压后的目录加入php.ini中的include_path 3 将脚本pear-phpunit改名为phpunit 4 将phpunit脚本中的@...

    composer 安装PHPUnit

    NULL 博文链接:https://vtrtbb.iteye.com/blog/2322089

    PHPUnit PHP测试框架安装方法

    Windows平台LAMP环境XAMPP 1.7.3下如何安装PHPUnit呢? 首先,以管理员身份运行cmd,使用pear添加phpunit频道: D:\xampp\php>pear channel-discover pear.phpunit.de Channel “pear.phpunit.de” is already ...

    phpunit安装方法

    PHPUnit是一个轻量级的PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整移植

    PHPUnit安装及使用示例

    PHPUnit是zend官方大力...windows下将php的环境变量加入到PATH环境变量中。 简单使用: 复制代码 代码如下: <?php class StackTest extends PHPUnit_Framework_TestCase {    public function testArray()  {  

    Windows下的PHP安装pear教程

    因为需要安装 PHPUnit,要先装 pear,网上的教程大多数是以双击 go-pear.bat 开始,但是我安装的php文件夹里压根没有这个文件。 经过几次搜索之后终于找到了办法,解决步骤如下: 1、下载下面连接的文件至 go-pear....

    phpunit附属lib

    如果你在用PHPUNIT会报 include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory include(PHPUnit_Extensions_Database_TestCase.php): failed to open stream: No such...

    Windows下wamp php单元测试工具PHPUnit安装及生成日志文件配置方法

    本文实例讲述了Windows下wamp php单元测试工具PHPUnit安装及生成日志文件配置方法。分享给大家供大家参考,具体如下: phpunit下载网站 http://www.phpunit.cn/ 一、安装PHPUnit 1.选择版本 我用的是php版本是5.6.25...

    CentOS环境下安装PHPUnit的方法分析

    本文实例讲述了CentOS环境下安装PHPUnit的方法。分享给大家供大家参考,具体如下: PHPUnit之于PHP正如JUnit之于Java,是PHP程序员用来写单元测试代码的工具。由于上级要求员工写代码时也要写单元测试代码,于是我在...

Global site tag (gtag.js) - Google Analytics