window中用pear安装phpunit

本文介绍如何在Windows环境下安装PEAR及PHPUnit,并提供了配置zendStudio8与PHPUnit整合的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装pear
1)在命令行中,进入php安装目录,如我的目录D:\php\Zend\ZendServer\bin,运行:

go-pear
若出现以下错误:
phar "D:\php\Zend\ZendServer\bin\PEAR\go-pear.phar" does not have a signature
Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: pha
r error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in D:\
php\Zend\ZendServer\bin\PEAR\go-pear.phar on line 1236

解决方法:打开php.ini文件,在最后一行加上:phar.require_hash = Off

4)此时pear应该安装成功了,更新至最新版本:

pear upgrade-all
(这一步挺重要的,phpunit貌似是使用pear的1.9.x才能安装)
2.安装phpunit:
1)添加phpunit的频道

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
2)安装:

pear install phpunit/PHPUnit
若出现此错误:
Fatal error:require_once():Failed opening required ‘Structures/Graph.php’
解决方法如下,下载此压缩包:

http://download.pear.php.net/package/Structures_Graph-1.0.3.tgz

解压并把Structures目录复制到D:\php\Zend\ZendServer\bin\PEAR下

若出现:
could not extract the package.xml file
Error:cannot download “phpunit/XXXX”
可能是pear下载目录的路径有空格如:D:/program files/
解决方法如下:

pear config-set temp_dir "C:\tmp"
pear config-set download_dir "C:\tmp"
这里设置目录的路径无空格就行了,想设哪里到是无所谓。

最后测试下是否安装成功,cmd中运行:

phpunit

3、zendStudio8 整合phpunit

1)、首先在zend studio 中新建一个项目。
2)、在项目项目上右键 出现 Properties ,点击 Properties 在出现的框中选择 PHP Include Path -> Libraries -> Add Library ,选择PHPUnit 3.x 即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值