使用 xampp 安装 PEAR 和 PHPUnit

发布于 2024-11-04 04:56:49 字数 1253 浏览 0 评论 0原文

我正在尝试启动并运行 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 下,

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

谢谢

I am trying to get PHPUnit up and running the following are the steps I am currently following:

### 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)

This works up untill the point where I have to pear upgrade --alldeps after downloading all the bits it needs i get:#

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
.....

My PHP directory is installed under C:\xampp\php

What do I need to change so that it knows the correct place to add these directories/ files?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

沐歌 2024-11-11 04:56:50

您可能需要将

这会导致

php go-pear.phar
pear clear-cache 
pear update-channels
pear upgrade --alldeps -f 
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no
pear config-set preferred_state beta
pear install --onlyreqdeps phpunit/PHPUnit

You might want to add

This results in

php go-pear.phar
pear clear-cache 
pear update-channels
pear upgrade --alldeps -f 
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no
pear config-set preferred_state beta
pear install --onlyreqdeps phpunit/PHPUnit
酒中人 2024-11-11 04:56:50

您无法再通过 PEAR 安装 PHPUnit https://stackoverflow.com/a/28457160/1783439

PHPUnit 现在作为XAMPP。您可以在这里找到它:C:\xampp\php

在命令提示符处:

cd c:\xampp\php
phpunit

You cannot install PHPUnit via PEAR anymore https://stackoverflow.com/a/28457160/1783439

PHPUnit now comes as part of XAMPP. You can find it here: C:\xampp\php.

At the command prompt:

cd c:\xampp\php
phpunit
小傻瓜 2024-11-11 04:56:49

要安装在 D:\xampp\php 中,请使用 pear config-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

To install in D:\xampp\php, set the following directory paths using pear config-set command

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
埖埖迣鎅 2024-11-11 04:56:49

看来问题不在于 PHPUnit,而在于您的 pear 安装

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

以太修复这些权限或以管理员权限启动 cmd 提示符(windowsbutton & 输入“cmd”,然后 strg+shift+enter )并重新运行命令。

It seems the issue is not with PHPUnit but with your pear installation in general.

The user you run the install with does not have the privileges to create the needed folders.

Ether fix those permissions or start the cmd prompt with admin privileges (windowsbutton & enter "cmd" then strg+shift+enter) and rerun the commands.

执妄 2024-11-11 04:56:49

这是在 xampp 中安装 propel orm 类似问题的解决方案。默认情况下,pear 尝试安装在 c:\php\pear\data 中,但该文件夹不存在,因为 pear 位于 c:\xampp\php\pear 中。

显示 pear 配置:

pear config-show
...
pear config-get data_dir
c:\php\pear\data

将 pear 配置更改为:

pear config-set data_dir c:\xampp\php\pear\data

我希望这有用;)

this is a solution for a similar problem install propel orm in xampp. By default, pear tries install in c:\php\pear\data, and this folder don't exists, because pear is in c:\xampp\php\pear.

Show pear configutarion:

pear config-show
...
pear config-get data_dir
c:\php\pear\data

Change the pear configuration to:

pear config-set data_dir c:\xampp\php\pear\data

i hope this is useful ;)

巴黎夜雨 2024-11-11 04:56:49

如果您使用的是 Widows 8,请确保您打开了 以管理员身份运行命令窗口,否则操作系统将默默拒绝目录创建!

If you are on Widows 8, make sure you opened a command window as administrator, otherwise dir creation will be silently rejected by the OS !

﹂绝世的画 2024-11-11 04:56:49

我能够通过创建 符号链接 在 C:\ 中,指向 xamp php 安装目录。这使得期望 php 位于 C:\php 中的所有内容都满意,同时不会破坏任何期望 php 位于 xampp 中的内容:

在 cmd.exe 中,我输入:

C:\Windows>cd \
C:\>junction php C:\path\to\xampp\php

我更新了我的 php.ini 以使用 C:\php 作为位置对于 PHP.
然后我安装了pear(作为本地安装,而不是系统)。
一旦安装了 pear,安装 phpunit 就很简单了:

C:\>pear channel-discover components.ez.no
C:\>pear channel-discover pear.phpunit.de
C:\>pear channel-discover pear.symfony-project.com

最后,

C:\>pear install --alldeps phpunit/PHPUnit

I was able to get pear (and subsequently, phpunit) working by creating a symlink in C:\ that points to the xamp php installation directory. That makes everything that expects php to be in C:\php happy, while not breaking anything that expected php to be in xampp:

In cmd.exe, I typed:

C:\Windows>cd \
C:\>junction php C:\path\to\xampp\php

I updated my php.ini to use C:\php as the location for php.
I then installed pear (as a local installation, not system).
Once pear was installed, installing phpunit was simple:

C:\>pear channel-discover components.ez.no
C:\>pear channel-discover pear.phpunit.de
C:\>pear channel-discover pear.symfony-project.com

And then finally,

C:\>pear install --alldeps phpunit/PHPUnit
薄暮涼年 2024-11-11 04:56:49

这可能有助于点击以下链接:
http://forum.kohanaframework.org/discussion/7346 /installing-phpunit-on-windows-xampp/p1

  1. 打开命令提示符并转到 C:\xampp\php
  2. 键入“pear update-channels”(更新通道定义)
  3. 键入“pear Upgrade”(升级所有现有的包和 pear)
  4. 输入“pear channel-discover Components.ez.no”(PHPUnit 需要此)
  5. 输入“pear channel-discover pear.symfony-project.com”(PHPUnit 也需要)
  6. 输入“pear channel-discover pear” .phpunit.de”(这是 phpunit)
  7. 输入“pear install --alldeps phpunit/PHPUnit”(安装 PHPUnit 和所有依赖项)

This may help follow the below link:
http://forum.kohanaframework.org/discussion/7346/installing-phpunit-on-windows-xampp/p1

  1. Open a command prompt and go to C:\xampp\php
  2. Type "pear update-channels" (updates channel definitions)
  3. Type "pear upgrade" (upgrades all existing packages and pear)
  4. Type "pear channel-discover components.ez.no" (this is needed for PHPUnit)
  5. Type "pear channel-discover pear.symfony-project.com" (also needed by PHPUnit)
  6. Type "pear channel-discover pear.phpunit.de" (This IS phpunit)
  7. Type "pear install --alldeps phpunit/PHPUnit" (installs PHPUnit and all dependencies)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文