使用 xampp 安装 PEAR 和 PHPUnit
我正在尝试启动并运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可能需要将
pear clear-cache
添加到 清除 REST/XML-RPC 缓存和pear config-set Preferred_state beta
以设置首选包状态为 beta这会导致
You might want to add
pear clear-cache
to clear the REST/XML-RPC cache andpear config-set preferred_state beta
to set the preferred package state to betaThis results in
您无法再通过 PEAR 安装 PHPUnit https://stackoverflow.com/a/28457160/1783439
PHPUnit 现在作为XAMPP。您可以在这里找到它:
C:\xampp\php
。在命令提示符处:
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:
要安装在 D:\xampp\php 中,请使用 pear config-set 命令设置以下目录路径
To install in D:\xampp\php, set the following directory paths using pear config-set command
看来问题不在于 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.
这是在 xampp 中安装 propel orm 类似问题的解决方案。默认情况下,pear 尝试安装在 c:\php\pear\data 中,但该文件夹不存在,因为 pear 位于 c:\xampp\php\pear 中。
显示 pear 配置:
将 pear 配置更改为:
我希望这有用;)
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:
Change the pear configuration to:
i hope this is useful ;)
如果您使用的是 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 !
我能够通过创建 符号链接 在 C:\ 中,指向 xamp php 安装目录。这使得期望 php 位于 C:\php 中的所有内容都满意,同时不会破坏任何期望 php 位于 xampp 中的内容:
在 cmd.exe 中,我输入:
我更新了我的 php.ini 以使用 C:\php 作为位置对于 PHP.
然后我安装了pear(作为本地安装,而不是系统)。
一旦安装了 pear,安装 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:
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:
And then finally,
这可能有助于点击以下链接:
http://forum.kohanaframework.org/discussion/7346 /installing-phpunit-on-windows-xampp/p1
This may help follow the below link:
http://forum.kohanaframework.org/discussion/7346/installing-phpunit-on-windows-xampp/p1