0

0

Windows上安装PEAR, PHPUnit成功

php中文网

php中文网

发布时间:2016-06-13 10:40:59

|

975人浏览过

|

来源于php中文网

原创

Windows下安装PEAR, PHPUnit成功

环境要求:

windows + apmserv5.2.6/php5以上

安装步骤:

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

2、安装命令

d:cd D:\APMServ5.2.6\PHPD:\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.

立即学习PHP免费学习笔记(深入)”;

?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

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

ectouch多通道支付插件
ectouch多通道支付插件

ectouch多通道支付插件可以为ectouch网站提供相应的在线支付功能。安装步骤:一、备份原ectouch网站源文件;二、下载以上“ectouch支付插件”附件;三、解压缩后上传“payment”目录至“ectouch”目录下的“plugins”目录中,覆盖原文件。四、安装完成

下载

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

相关文章

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载

相关标签:

php

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
全国统一发票查询平台入口合集
全国统一发票查询平台入口合集

本专题整合了全国统一发票查询入口地址合集,阅读专题下面的文章了解更多详细入口。

19

2026.02.03

短剧入口地址汇总
短剧入口地址汇总

本专题整合了短剧app推荐平台,阅读专题下面的文章了解更多详细入口。

27

2026.02.03

植物大战僵尸版本入口地址汇总
植物大战僵尸版本入口地址汇总

本专题整合了植物大战僵尸版本入口地址汇总,前往文章中寻找想要的答案。

15

2026.02.03

c语言中/相关合集
c语言中/相关合集

本专题整合了c语言中/的用法、含义解释。阅读专题下面的文章了解更多详细内容。

3

2026.02.03

漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题
漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题

本专题围绕漫蛙漫画(Manwa / Manwa2)官网网页版入口进行整理,涵盖漫蛙漫画官方主页访问方式、网页版在线阅读入口、台版正版漫画浏览说明及基础使用指引,帮助用户快速进入漫蛙漫画官网,稳定在线阅读正版漫画内容,避免误入非官方页面。

13

2026.02.03

Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口
Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口

本专题汇总了俄罗斯知名搜索引擎 Yandex 的官网入口、免登录访问地址、中文登录方法与网页版使用指南,帮助用户稳定访问 Yandex 官网,并提供一站式入口汇总。无论是登录入口还是在线搜索,用户都能快速获取最新稳定的访问链接与使用指南。

114

2026.02.03

Java 设计模式与重构实践
Java 设计模式与重构实践

本专题专注讲解 Java 中常用的设计模式,包括单例模式、工厂模式、观察者模式、策略模式等,并结合代码重构实践,帮助学习者掌握 如何运用设计模式优化代码结构,提高代码的可读性、可维护性和扩展性。通过具体示例,展示设计模式如何解决实际开发中的复杂问题。

3

2026.02.03

C# 并发与异步编程
C# 并发与异步编程

本专题系统讲解 C# 异步编程与并发控制,重点介绍 async 和 await 关键字、Task 类、线程池管理、并发数据结构、死锁与线程安全问题。通过多个实战项目,帮助学习者掌握 如何在 C# 中编写高效的异步代码,提升应用的并发性能与响应速度。

2

2026.02.03

Python 强化学习与深度Q网络(DQN)
Python 强化学习与深度Q网络(DQN)

本专题深入讲解 Python 在强化学习(Reinforcement Learning)中的应用,重点介绍 深度Q网络(DQN) 及其实现方法,涵盖 Q-learning 算法、深度学习与神经网络的结合、环境模拟与奖励机制设计、探索与利用的平衡等。通过构建一个简单的游戏AI,帮助学习者掌握 如何使用 Python 训练智能体在动态环境中作出决策。

3

2026.02.03

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PHP课程
PHP课程

共137课时 | 10.9万人学习

JavaScript ES5基础线上课程教学
JavaScript ES5基础线上课程教学

共6课时 | 11.2万人学习

PHP新手语法线上课程教学
PHP新手语法线上课程教学

共13课时 | 0.9万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号