Windows通过PEAR安装PHPUnit,通过PEAR安装PHPUnit。

时间:2022-10-08 07:06:54

When I run:

当我运行:

peardev install phpunit/PHPUnit

I get the following:

我得到以下:

No releases available for package "pear.phpunit.de/PHPUnit"
install failed

I have run the following:

我已经运行了以下内容:

pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized

and

pear install --alldeps phpunit/PHPUnit
No releases available for package "pear.phpunit.de/PHPUnit"
install failed

and

pear remote-list -c phpunit
CHANNEL PHPUNIT AVAILABLE PACKAGES:
===================================
PACKAGE            VERSION
DbUnit             1.0.2
File_Iterator      1.2.6
Object_Freezer     1.0.0
PHPUnit            3.5.14
PHPUnit_MockObject 1.0.9
PHPUnit_Selenium   1.0.3
PHP_CodeBrowser    1.0.0
PHP_CodeCoverage   1.0.4
PHP_Timer          1.0.0
PHP_TokenStream    1.0.1
Text_Template      1.1.0
bytekit            1.1.1
phpUnderControl    0.5.0
phpcpd             1.3.2
phpdcd             0.9.2
phploc             1.6.1
ppw                1.0.4
test_helpers       1.1.0

and

pear upgrade pear
No releases available for package "pear.php.net/pear"
upgrade failed

Please help I am tearing my hair out here.

请帮我把头发弄乱。

UPDATED

更新

C:\Program Files\PHP>pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized

C:\Program Files\PHP>pear channel-discover components.ez.no
Channel "components.ez.no" is already initialized

C:\Program Files\PHP>pear channel-discover pear.symfony-project.com
Channel "pear.symfony-project.com" is already initialized

C:\Program Files\PHP>pear install phpunit/PHPUnit
No releases available for package "pear.phpunit.de/PHPUnit"
install failed

UPDATE 2

更新2

C:\Program Files\PHP>pear update-channels
Updating channel "components.ez.no"
Channel "components.ez.no" is up to date
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is up to date
Updating channel "pear.phpunit.de"
Channel "pear.phpunit.de" is up to date
Updating channel "pear.symfony-project.com"
Channel "pear.symfony-project.com" is up to date
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date

Update 3

更新3

ran

C:\Program Files\PHP>pear clear-cache
reading directory C:\Users\stephen\AppData\Local\Temp\pear\cache
136 cache entries cleared

C:\Program Files\PHP>pear install -a -f phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
.0.5)
downloading PHPUnit-3.5.14.tgz ...
Starting to download PHPUnit-3.5.14.tgz (118,697 bytes)
..........................done: 118,697 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\PHPUnit-3.
5.14.tgz" Unable to create directory 'C:/Program/tmpF4D2.tmp'
Unable to create path for C:/Program/tmpF4D2.tmp/package.xml
Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit"
downloading DbUnit-1.0.2.tgz ...
Starting to download DbUnit-1.0.2.tgz (39,231 bytes)
...done: 39,231 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\DbUnit-1.0
.2.tgz" Unable to create directory 'C:/Program/tmpF64A.tmp'
Unable to create path for C:/Program/tmpF64A.tmp/package.xml
Download of "phpunit/DbUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/DbUnit"
downloading File_Iterator-1.2.6.tgz ...
Starting to download File_Iterator-1.2.6.tgz (3,439 bytes)
...done: 3,439 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\File_Itera
tor-1.2.6.tgz" Unable to create directory 'C:/Program/tmpF6E7.tmp'
Unable to create path for C:/Program/tmpF6E7.tmp/package.xml
Download of "phpunit/File_Iterator" succeeded, but it is not a valid package arc
hive
Error: cannot download "phpunit/File_Iterator"
downloading PHP_CodeCoverage-1.0.4.tgz ...
Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
...done: 115,029 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\PHP_CodeCo
verage-1.0.4.tgz" Unable to create directory 'C:/Program/tmpF83F.tmp'
Unable to create path for C:/Program/tmpF83F.tmp/package.xml
Download of "phpunit/PHP_CodeCoverage" succeeded, but it is not a valid package
archive
Error: cannot download "phpunit/PHP_CodeCoverage"
downloading PHPUnit_MockObject-1.0.9.tgz ...
Starting to download PHPUnit_MockObject-1.0.9.tgz (18,414 bytes)
...done: 18,414 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\PHPUnit_Mo
ckObject-1.0.9.tgz" Unable to create directory 'C:/Program/tmpF939.tmp'
Unable to create path for C:/Program/tmpF939.tmp/package.xml
Download of "phpunit/PHPUnit_MockObject" succeeded, but it is not a valid packag
e archive
Error: cannot download "phpunit/PHPUnit_MockObject"
downloading PHPUnit_Selenium-1.0.3.tgz ...
Starting to download PHPUnit_Selenium-1.0.3.tgz (16,587 bytes)
...done: 16,587 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\PHPUnit_Se
lenium-1.0.3.tgz" Unable to create directory 'C:/Program/tmpF9F6.tmp'
Unable to create path for C:/Program/tmpF9F6.tmp/package.xml
Download of "phpunit/PHPUnit_Selenium" succeeded, but it is not a valid package
archive
Error: cannot download "phpunit/PHPUnit_Selenium"
downloading YAML-1.0.5.tgz ...
Starting to download YAML-1.0.5.tgz (9,966 bytes)
...done: 9,966 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\YAML-1.0.5
.tgz" Unable to create directory 'C:/Program/tmpFA83.tmp'
Unable to create path for C:/Program/tmpFA83.tmp/package.xml
Download of "symfony/YAML" succeeded, but it is not a valid package archive
Error: cannot download "symfony/YAML"
downloading PHP_TokenStream-1.0.1.tgz ...
Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
...done: 7,250 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\PHP_TokenS
tream-1.0.1.tgz" Unable to create directory 'C:/Program/tmpFB10.tmp'
Unable to create path for C:/Program/tmpFB10.tmp/package.xml
Download of "phpunit/PHP_TokenStream" succeeded, but it is not a valid package a
rchive
Error: cannot download "phpunit/PHP_TokenStream"
downloading ConsoleTools-1.6.1.tgz ...
Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
...done: 869,994 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\ConsoleToo
ls-1.6.1.tgz" Unable to create directory 'C:/Program/tmp9D.tmp'
Unable to create path for C:/Program/tmp9D.tmp/package.xml
Download of "ezc/ConsoleTools" succeeded, but it is not a valid package archive
Error: cannot download "ezc/ConsoleTools"
downloading Base-1.8.tgz ...
Starting to download Base-1.8.tgz (236,357 bytes)
...done: 236,357 bytes
could not extract the package.xml file from "C:\Program Files\PHP\tmp\Base-1.8.t
gz" Unable to create directory 'C:/Program/tmp36C.tmp'
Unable to create path for C:/Program/tmp36C.tmp/package.xml
Download of "ezc/Base" succeeded, but it is not a valid package archive
Error: cannot download "ezc/Base"
Download failed
install failed

Update 4

更新4

Installed PHP at c:\PHP

PHP安装在c:\ PHP

Ran the above steps and I now get:

运行上面的步骤,现在我得到:

C:\PHP>peardev install phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is
 1.9.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.2), installed version is
1.9.0
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed vers
ion is 1.9.0
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed v
ersion is 1.9.0
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.
2.2)
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
.0.5)
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.2), installed
 version is 1.9.0
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.2), installed v
ersion is 1.9.0
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed ve
rsion is 1.9.0
No valid packages found
install failed

C:\PHP>pear upgrade pear
pear/pear is already installed and is the same as the released version 1.9.3
upgrade failed

Update 5

更新5

C:\PHP>pear upgrade pear
pear/pear is already installed and is the same as the released version 1.9.3
upgrade failed

C:\PHP>pear -V
PEAR Version: 1.9.0
PHP Version: 5.2.17
Zend Engine Version: 2.2.0

Pear upgrade pear thinks I am 1.9.3 but pear says it is version 1.9.0

Pear升级时认为我是1.9.3,但Pear说我是1.9.0版本

6 个解决方案

#1


64  

I'm a really newbie but hope to be of any help.

我是个新手,但我希望能帮上忙。

I just succeeded installing PHPUnit a moment ago.

我刚才成功安装了PHPUnit。

My env. is Wamp2.1.

我的env。Wamp2.1。

I don't know exactly how this works but it worked for me, so try this.

我不知道这是怎么回事,但是对我来说,试试这个。

pear clear-cache then,

梨clear-cache之后,

pear install -a -f phpunit/PHPUnit

Somewhere in the failing message, I saw something about cache so I used clear-cache.

在失败的消息中,我看到了一些关于缓存的内容,所以我使用了clear-cache。

It did some trick in installing process, I guess.

我猜它在安装过程中起了一些作用。

Good luck!

好运!

#2


13  

From the manual page

从手动页面

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear install phpunit/PHPUnit

Make sure you have the two extra channels that are required.

确保您有两个额外的通道是必需的。

Edit:

编辑:

Try following this advice: pear update-channels

尝试遵循以下建议:pear更新-通道

#3


4  

could not extract the package.xml file from "C:\Program Files\PHP\tmp\YAML-1.0.5
.tgz" Unable to create directory 'C:/Program/tmpFA83.tmp'
Unable to create path for C:/Program/tmpFA83.tmp/package.xml

This is a bug in pear installer. It can't deal with the SPACE in your path and tries to read the wrong files. Installing your php in a folder without a space is the only 'fix' i know about :/

这是pear安装程序中的一个错误。它不能处理路径中的空间,并试图读取错误的文件。在没有空格的文件夹中安装php是我所知道的唯一“修复”方法:/


Update 5:

更新5:

pear install --force --alldeps pear/pear

do all channel updates it asks for

是否所有频道更新它要求

pear install --force --alldeps phpunit/PHPUnit

if asked for channel updates, do those and repeat

如果需要频道更新,请执行这些操作并重复

#4


2  

if the Pear command didn't work try this:

如果Pear命令不起作用,请尝试以下操作:

First off I'm assuming xampp is installed to C:\xampp

首先假设xampp安装到C:\xampp

  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和所有依赖项)

#5


1  

You have several PEAR versions installed and are executing the wrong one. See Pear on windows displaying different version numbers for how to fix it.

您已经安装了几个PEAR版本,并且正在执行错误的版本。查看windows上显示不同版本号的Pear,了解如何修复它。

#6


1  

make sure you're running command prompt as administrator and follow this

请确保以管理员的身份运行命令提示符并遵循此命令

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear install phpunit/PHPUnit

#1


64  

I'm a really newbie but hope to be of any help.

我是个新手,但我希望能帮上忙。

I just succeeded installing PHPUnit a moment ago.

我刚才成功安装了PHPUnit。

My env. is Wamp2.1.

我的env。Wamp2.1。

I don't know exactly how this works but it worked for me, so try this.

我不知道这是怎么回事,但是对我来说,试试这个。

pear clear-cache then,

梨clear-cache之后,

pear install -a -f phpunit/PHPUnit

Somewhere in the failing message, I saw something about cache so I used clear-cache.

在失败的消息中,我看到了一些关于缓存的内容,所以我使用了clear-cache。

It did some trick in installing process, I guess.

我猜它在安装过程中起了一些作用。

Good luck!

好运!

#2


13  

From the manual page

从手动页面

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear install phpunit/PHPUnit

Make sure you have the two extra channels that are required.

确保您有两个额外的通道是必需的。

Edit:

编辑:

Try following this advice: pear update-channels

尝试遵循以下建议:pear更新-通道

#3


4  

could not extract the package.xml file from "C:\Program Files\PHP\tmp\YAML-1.0.5
.tgz" Unable to create directory 'C:/Program/tmpFA83.tmp'
Unable to create path for C:/Program/tmpFA83.tmp/package.xml

This is a bug in pear installer. It can't deal with the SPACE in your path and tries to read the wrong files. Installing your php in a folder without a space is the only 'fix' i know about :/

这是pear安装程序中的一个错误。它不能处理路径中的空间,并试图读取错误的文件。在没有空格的文件夹中安装php是我所知道的唯一“修复”方法:/


Update 5:

更新5:

pear install --force --alldeps pear/pear

do all channel updates it asks for

是否所有频道更新它要求

pear install --force --alldeps phpunit/PHPUnit

if asked for channel updates, do those and repeat

如果需要频道更新,请执行这些操作并重复

#4


2  

if the Pear command didn't work try this:

如果Pear命令不起作用,请尝试以下操作:

First off I'm assuming xampp is installed to C:\xampp

首先假设xampp安装到C:\xampp

  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和所有依赖项)

#5


1  

You have several PEAR versions installed and are executing the wrong one. See Pear on windows displaying different version numbers for how to fix it.

您已经安装了几个PEAR版本,并且正在执行错误的版本。查看windows上显示不同版本号的Pear,了解如何修复它。

#6


1  

make sure you're running command prompt as administrator and follow this

请确保以管理员的身份运行命令提示符并遵循此命令

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear install phpunit/PHPUnit