使用 xampp 安装 PEAR 和 PHPUnit

2022-08-30 16:52:12

我正在尝试启动PHPUnit并运行以下步骤,这些步骤是我当前遵循的步骤:

### Install new PEAR Version needed for PHPUnit 3.X
### Download:  http://pear.php.net/go-pear.phar Save it under C:\xampp\php

Open a command prompt and go to C:\xampp\php
Type "php go-pear.phar" (Installs new PEAR)
Type "pear update-channels" (updates channel definitions)
Type "pear upgrade --alldeps" (upgrades all existing packages and pear)
Type "pear channel-discover components.ez.no" (this is needed for PHPUnit)
Type "pear channel-discover pear.symfony-project.com" (also needed by PHPUnit)
Type "pear channel-discover pear.phpunit.de" (This IS phpunit)
Type "pear install --alldeps phpunit/PHPUnit" (installs PHPUnit and all dependencies)

这一直工作到我必须下载所有需要的位后才能得到:#pear upgrade --alldeps

ERROR: failed to mkdir C:\php\pear\data\Auth\Auth\Frontend
ERROR: failed to mkdir C:\php\pear\docs\Benchmark\doc
ERROR: failed to mkdir C:\php\pear\data\Cache\Container
ERROR: failed to mkdir C:\php\pear\docs\Cache_Lite\docs
ERROR: failed to mkdir C:\php\pear\docs\Calendar\docs\examples
ERROR: failed to mkdir C:\php\pear\docs\Config\docs
.....

我的 PHP 目录安装在C:\xampp\php

我需要更改什么才能知道添加这些目录/文件的正确位置?

谢谢


答案 1

要在 D:\xampp\php 中安装,请使用 pear 配置-set 命令设置以下目录路径

D:
cd D:\xampp\php
pear config-set doc_dir d:\xampp\php\pear\docs
pear config-set cfg_dir d:\xampp\php\pear\cfg
pear config-set data_dir d:\xampp\php\pear\data
pear config-set cache_dir d:\xampp\php\pear\cache
pear config-set download_dir d:\xampp\php\pear\download
pear config-set temp_dir d:\xampp\php\pear\temp
pear config-set test_dir d:\xampp\php\pear\tests
pear config-set www_dir d:\xampp\php\pear\www

答案 2

似乎问题不在于PHPUnit,而在于您的梨安装

运行安装的用户没有创建所需文件夹的权限。

Ether修复这些权限或使用管理员权限启动cmd提示符(然后输入“cmd”,然后输入++)并重新运行命令。windowsbuttonstrgshiftenter


推荐