Installing PEAR and PHPUnit with xampp

 ̄綄美尐妖づ 提交于 2019-11-28 16:14:14

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.

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
aris

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

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 !

Daniel Miladinov

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

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)

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
nu everest

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!