如何使用PEAR正确安装PHPUnit?

时间:2022-09-30 07:07:23

I have had to de- and reinstall a newer version of PHPUnit following these directions. Now when I'm launching this line

我不得不按照这些指示去除并重新安装更新版本的PHPUnit。现在我正在推出这条线

sudo pear install --alldeps phpunit/PHPUnit

I see an error message, that looks like this.

我看到一条错误消息,看起来像这样。

Unknown remote channel: pear.symfony.com
phpunit/PHPUnit requires package "channel://pear.symfony.com/Yaml" (version >= 2.1.0)
No valid packages found

If I install just Yaml by launching

如果我通过启动安装Yaml

sudo pear install symfony/YAML

an older version (1.0.6) will be installed that doesn't meet the dependency of PHPUnit. How can I possibly solve this?

将安装不符合PHPUnit依赖性的旧版本(1.0.6)。我怎么可能解决这个问题?

8 个解决方案

#1


85  

I had the same problem while upgrading my phpunit.

升级我的phpunit时遇到了同样的问题。

This solved the problem:

这解决了这个问题:

pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml

Then run:

然后运行:

pear install --alldeps pear.phpunit.de/PHPUnit

OBS: I think the pear install pear.symfony.com/Yaml is not necessary. I'm just posting it because it is exactly the way I solved my problem.

OBS:我认为pear install pear.symfony.com/Yaml不是必需的。我只是发布它,因为它正是我解决问题的方式。

#2


10  

Use this, as described in the PHPUnit docs: (i don't what sudo means, this is how I do it on a windows PC):

使用它,如PHPUnit文档中所述:(我不是sudo的意思,这是我在Windows PC上的方式):

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

#3


5  

I also had this error message:

我也有这个错误消息:

Unknown remote channel: pear.symfony.com

未知的远程频道:pear.symfony.com

Solved creating an alias:

解决了创建别名:

pear channel-alias pear.symfony-project.com pear.symfony.com

and then

接着

channel-discover pear.symfony-project.com

sudo pear channel-discover components.ez.no

sudo pear update-channels

sudo pear upgrade-all

sudo pear install --force --alldeps phpunit/PHPUnit

#4


2  

First: locate pear you may have multiple versions installed and this could be a pain.

首先:找到梨你可能有多个版本安装,这可能是一个痛苦。

At work we have something like this in our intranet:

在工作中,我们的内联网中有类似的内容:

sudo [your pear install] channel-update pear.php.net  
sudo [your pear install] upgrade pear  
sudo [your pear install] channel-discover pear.phpunit.de  
sudo [your pear install] install --alldeps phpunit/PHPUnit

I know theres a more automated way to install it using: go-pear ( http://pear.php.net/manual/en/installation.getting.php )

我知道有一种更自动化的方式来安装它:go-pear(http://pear.php.net/manual/en/installation.getting.php)

However, if you already have some other install of pear it will totally wreck everything and you'll spend quite some time trying to fix it. I think the biggest hurdle is being able to tell all the libraries where each other is.

但是,如果你已经安装了一些梨,它将完全破坏一切,你会花很多时间来修复它。我认为最大的障碍是能够告诉所有图书馆彼此在哪里。

#5


0  

sudo pear install -a phpunit
sudo pear channel-discover pear.phpunit.de

I had similar problem complaining about "Unknown remote channel: pear.symfony.com". had to do (without sudo, I got weird error about cannot open some file)

我有类似的问题抱怨“未知的远程频道:pear.symfony.com”。不得不做(没有sudo,我得到奇怪的错误,无法打开一些文件)

sudo pear channel-discover pear.symfony.com

then

然后

sudo pear install phpunit/PHPUnit

Now I can see phpunit in my /usr/bin

现在我可以在/ usr / bin中看到phpunit

#6


0  

Process mentioned by PutzKipa works however you might need super user privileges. For ubuntu add sudo before each command.

PutzKipa提到的过程有效但您可能需要超级用户权限。对于ubuntu,在每个命令之前添加sudo。

#7


0  

Following Plínio César, I solved it finally, but with slight variation:

继PlínioCésar之后,我终于解决了它,但略有不同:

First I did a "sudo apt-get remove phpunit" to remove the faulty installation. Then using pear to do the phpunit installation:

首先,我做了一个“sudo apt-get remove phpunit”来删除错误的安装。然后用pear来做phpunit安装:

sudo pear install pear.symfony.com/Yaml

sudo pear install pear.symfony.com/Yaml

sudo pear channel-discover pear.phpunit.de

sudo pear channel-discover pear.phpunit.de

sudo pear config-set auto_discover 1

sudo pear config-set auto_discover 1

sudo pear install --alldeps pear.phpunit.de/PHPUnit

sudo pear install --alldeps pear.phpunit.de/PHPUnit

Thanks Plinio Cesar!!!

谢谢Plinio Cesar !!!

#8


0  

The easiest way to obtain PHPUnit in Ubuntu, Debian, Fedora or OpenSUSE is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file.

在Ubuntu,Debian,Fedora或OpenSUSE中获取PHPUnit的最简单方法是下载一个PHP归档(PHAR),它包含捆绑在一个文件中的PHPUnit的所有必需(以及一些可选)依赖项。

Open the terminal and type:

打开终端并输入:

wget https://phar.phpunit.de/phpunit.phar  # download the PHP Archive (PHAR) file  
chmod +x phpunit.phar   
sudo mv phpunit.phar /usr/local/bin/phpunit   

There are many different versions of phpunit.phar at https://phar.phpunit.de/. If you use the first command, it will select and download the latest version.

在https://phar.phpunit.de/上有许多不同版本的phpunit.phar。如果您使用第一个命令,它将选择并下载最新版本。

Note: The /usr/local/bin/ path in the last command is correct for Ubuntu, Debian, Fedora and OpenSUSE distributions and also for other Linux distributions that have a /usr/local/bin/ directory.

注意:最后一个命令中的/ usr / local / bin / path对于Ubuntu,Debian,Fedora和OpenSUSE发行版以及其他具有/ usr / local / bin /目录的Linux发行版都是正确的。

Reference: What is /usr/local/bin? Came across it in an script installation for Applescript but would like to know more

参考:什么是/ usr / local / bin?在Applescript的脚本安装中遇到了它,但想知道更多

#1


85  

I had the same problem while upgrading my phpunit.

升级我的phpunit时遇到了同样的问题。

This solved the problem:

这解决了这个问题:

pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml

Then run:

然后运行:

pear install --alldeps pear.phpunit.de/PHPUnit

OBS: I think the pear install pear.symfony.com/Yaml is not necessary. I'm just posting it because it is exactly the way I solved my problem.

OBS:我认为pear install pear.symfony.com/Yaml不是必需的。我只是发布它,因为它正是我解决问题的方式。

#2


10  

Use this, as described in the PHPUnit docs: (i don't what sudo means, this is how I do it on a windows PC):

使用它,如PHPUnit文档中所述:(我不是sudo的意思,这是我在Windows PC上的方式):

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

#3


5  

I also had this error message:

我也有这个错误消息:

Unknown remote channel: pear.symfony.com

未知的远程频道:pear.symfony.com

Solved creating an alias:

解决了创建别名:

pear channel-alias pear.symfony-project.com pear.symfony.com

and then

接着

channel-discover pear.symfony-project.com

sudo pear channel-discover components.ez.no

sudo pear update-channels

sudo pear upgrade-all

sudo pear install --force --alldeps phpunit/PHPUnit

#4


2  

First: locate pear you may have multiple versions installed and this could be a pain.

首先:找到梨你可能有多个版本安装,这可能是一个痛苦。

At work we have something like this in our intranet:

在工作中,我们的内联网中有类似的内容:

sudo [your pear install] channel-update pear.php.net  
sudo [your pear install] upgrade pear  
sudo [your pear install] channel-discover pear.phpunit.de  
sudo [your pear install] install --alldeps phpunit/PHPUnit

I know theres a more automated way to install it using: go-pear ( http://pear.php.net/manual/en/installation.getting.php )

我知道有一种更自动化的方式来安装它:go-pear(http://pear.php.net/manual/en/installation.getting.php)

However, if you already have some other install of pear it will totally wreck everything and you'll spend quite some time trying to fix it. I think the biggest hurdle is being able to tell all the libraries where each other is.

但是,如果你已经安装了一些梨,它将完全破坏一切,你会花很多时间来修复它。我认为最大的障碍是能够告诉所有图书馆彼此在哪里。

#5


0  

sudo pear install -a phpunit
sudo pear channel-discover pear.phpunit.de

I had similar problem complaining about "Unknown remote channel: pear.symfony.com". had to do (without sudo, I got weird error about cannot open some file)

我有类似的问题抱怨“未知的远程频道:pear.symfony.com”。不得不做(没有sudo,我得到奇怪的错误,无法打开一些文件)

sudo pear channel-discover pear.symfony.com

then

然后

sudo pear install phpunit/PHPUnit

Now I can see phpunit in my /usr/bin

现在我可以在/ usr / bin中看到phpunit

#6


0  

Process mentioned by PutzKipa works however you might need super user privileges. For ubuntu add sudo before each command.

PutzKipa提到的过程有效但您可能需要超级用户权限。对于ubuntu,在每个命令之前添加sudo。

#7


0  

Following Plínio César, I solved it finally, but with slight variation:

继PlínioCésar之后,我终于解决了它,但略有不同:

First I did a "sudo apt-get remove phpunit" to remove the faulty installation. Then using pear to do the phpunit installation:

首先,我做了一个“sudo apt-get remove phpunit”来删除错误的安装。然后用pear来做phpunit安装:

sudo pear install pear.symfony.com/Yaml

sudo pear install pear.symfony.com/Yaml

sudo pear channel-discover pear.phpunit.de

sudo pear channel-discover pear.phpunit.de

sudo pear config-set auto_discover 1

sudo pear config-set auto_discover 1

sudo pear install --alldeps pear.phpunit.de/PHPUnit

sudo pear install --alldeps pear.phpunit.de/PHPUnit

Thanks Plinio Cesar!!!

谢谢Plinio Cesar !!!

#8


0  

The easiest way to obtain PHPUnit in Ubuntu, Debian, Fedora or OpenSUSE is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file.

在Ubuntu,Debian,Fedora或OpenSUSE中获取PHPUnit的最简单方法是下载一个PHP归档(PHAR),它包含捆绑在一个文件中的PHPUnit的所有必需(以及一些可选)依赖项。

Open the terminal and type:

打开终端并输入:

wget https://phar.phpunit.de/phpunit.phar  # download the PHP Archive (PHAR) file  
chmod +x phpunit.phar   
sudo mv phpunit.phar /usr/local/bin/phpunit   

There are many different versions of phpunit.phar at https://phar.phpunit.de/. If you use the first command, it will select and download the latest version.

在https://phar.phpunit.de/上有许多不同版本的phpunit.phar。如果您使用第一个命令,它将选择并下载最新版本。

Note: The /usr/local/bin/ path in the last command is correct for Ubuntu, Debian, Fedora and OpenSUSE distributions and also for other Linux distributions that have a /usr/local/bin/ directory.

注意:最后一个命令中的/ usr / local / bin / path对于Ubuntu,Debian,Fedora和OpenSUSE发行版以及其他具有/ usr / local / bin /目录的Linux发行版都是正确的。

Reference: What is /usr/local/bin? Came across it in an script installation for Applescript but would like to know more

参考:什么是/ usr / local / bin?在Applescript的脚本安装中遇到了它,但想知道更多