使用xampp安装PEAR和PHPUnit

时间:2021-11-22 07:17:51

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

我正在尝试安装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)

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

这将一直到我必须升级到pear的时候——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
.....

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

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

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

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

Thanks

谢谢

8 个解决方案

#1


24  

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

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

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.

醚修复那些权限或启动具有管理权限的cmd提示符(windowsbutton & enter“cmd”然后strg+shift+enter)并重新运行命令。

#2


29  

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

要安装在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

#3


9  

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.

这是针对xampp中类似问题的解决方案。默认情况下,pear尝试在c:\php\pear数据中安装,但是这个文件夹不存在,因为pear在c:\xampp\php pear中。

Show pear configutarion:

显示梨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 ;)

我希望这是有用的;

#4


5  

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 !

如果您在寡妇8上,请确保您以管理员的身份打开了一个命令窗口,否则将会被操作系统拒绝创建dir !

#5


3  

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:

通过在C:\中创建一个指向xamp php安装目录的符号链接,我能够让pear(以及随后的phpunit)工作。这使得php的所有期望都是在C:\php中,而不是打破期望的php在xampp中的任何东西:

In cmd.exe, I typed:

在cmd。exe,我输入:

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:

我更新了我的php。使用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

And then finally,

最后,

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

#6


3  

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

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

  1. Open a command prompt and go to C:\xampp\php
  2. 打开命令提示符,转到C:\xampp\php
  3. Type "pear update-channels" (updates channel definitions)
  4. 输入“pear - update-channels”(更新通道定义)
  5. Type "pear upgrade" (upgrades all existing packages and pear)
  6. 键入“pear升级”(升级所有现有包和pear)
  7. Type "pear channel-discover components.ez.no" (this is needed for PHPUnit)
  8. 输入“梨channel-discover components.ez。否(这是PHPUnit需要的)
  9. Type "pear channel-discover pear.symfony-project.com" (also needed by PHPUnit)
  10. 输入“pear channel-discover pear.symfony-project.com”(PHPUnit也需要)
  11. Type "pear channel-discover pear.phpunit.de" (This IS phpunit)
  12. 键入“梨频道-发现梨。phpunit.de”(这是phpunit)
  13. Type "pear install --alldeps phpunit/PHPUnit" (installs PHPUnit and all dependencies)
  14. 类型“pear安装——alldeps phpunit/ phpunit”(安装phpunit和所有依赖项)

#7


2  

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

#8


0  

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

您不能再通过PEAR安装PHPUnit https://*.com/a/28457160/1783439

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

PHPUnit现在是XAMPP的一部分。你可以在这里找到它:C:\xampp\php。

At the command prompt:

在命令提示符:

cd c:\xampp\php
phpunit

#1


24  

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

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

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.

醚修复那些权限或启动具有管理权限的cmd提示符(windowsbutton & enter“cmd”然后strg+shift+enter)并重新运行命令。

#2


29  

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

要安装在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

#3


9  

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.

这是针对xampp中类似问题的解决方案。默认情况下,pear尝试在c:\php\pear数据中安装,但是这个文件夹不存在,因为pear在c:\xampp\php pear中。

Show pear configutarion:

显示梨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 ;)

我希望这是有用的;

#4


5  

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 !

如果您在寡妇8上,请确保您以管理员的身份打开了一个命令窗口,否则将会被操作系统拒绝创建dir !

#5


3  

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:

通过在C:\中创建一个指向xamp php安装目录的符号链接,我能够让pear(以及随后的phpunit)工作。这使得php的所有期望都是在C:\php中,而不是打破期望的php在xampp中的任何东西:

In cmd.exe, I typed:

在cmd。exe,我输入:

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:

我更新了我的php。使用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

And then finally,

最后,

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

#6


3  

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

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

  1. Open a command prompt and go to C:\xampp\php
  2. 打开命令提示符,转到C:\xampp\php
  3. Type "pear update-channels" (updates channel definitions)
  4. 输入“pear - update-channels”(更新通道定义)
  5. Type "pear upgrade" (upgrades all existing packages and pear)
  6. 键入“pear升级”(升级所有现有包和pear)
  7. Type "pear channel-discover components.ez.no" (this is needed for PHPUnit)
  8. 输入“梨channel-discover components.ez。否(这是PHPUnit需要的)
  9. Type "pear channel-discover pear.symfony-project.com" (also needed by PHPUnit)
  10. 输入“pear channel-discover pear.symfony-project.com”(PHPUnit也需要)
  11. Type "pear channel-discover pear.phpunit.de" (This IS phpunit)
  12. 键入“梨频道-发现梨。phpunit.de”(这是phpunit)
  13. Type "pear install --alldeps phpunit/PHPUnit" (installs PHPUnit and all dependencies)
  14. 类型“pear安装——alldeps phpunit/ phpunit”(安装phpunit和所有依赖项)

#7


2  

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

#8


0  

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

您不能再通过PEAR安装PHPUnit https://*.com/a/28457160/1783439

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

PHPUnit现在是XAMPP的一部分。你可以在这里找到它:C:\xampp\php。

At the command prompt:

在命令提示符:

cd c:\xampp\php
phpunit