php PEAR 包安装失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12318446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:20:06  来源:igfitidea点击:

PEAR package install fails

phpconsolephpunitpackagepear

提问by divide by zero

i try to install packages from pear.phpqatools.org/phpqatools

我尝试安装软件包 from pear.phpqatools.org/phpqatools

First of all command pear config-get php_dirreturns D:\Users\xampp\php\pearand I do not have rights to install on Cdrive.

首先命令pear config-get php_dir返回D:\Users\xampp\php\pear,我无权在C驱动器上安装。

Then according the instructions from http://phpqatools.org/I enter :

然后根据http://phpqatools.org/的说明 输入:

pear config-set auto_discover 1
pear install pear.phpqatools.org/phpqatools

I have also tried to enter: pear install --alldeps pear.phpqatools.org/phpqatools

我也试过输入: pear install --alldeps pear.phpqatools.org/phpqatools

But result of all these attempts is a failure...

但所有这些尝试的结果是失败......

This is a log:

这是一个日志:

Package "pear.phpqatools.org/phpqatools" dependency "pear.phpunit.de/PHPUnit" has no releases
Unknown remote channel: pear.pdepend.org
Unknown remote channel: pear.phpmd.org
Unknown remote channel: components.ez.no
Package "pear.phpunit.de/PHPUnit_SkeletonGenerator" dependency "pear.phpunit.de/Text_Template" has
no releases
Package "pear.phpunit.de/phpcpd" dependency "pear.phpunit.de/File_Iterator" has no releases
Package "pear.phpunit.de/phpcpd" dependency "pear.phpunit.de/PHP_Timer" has no releases
Unknown remote channel: components.ez.no
Package "pear.phpunit.de/phploc" dependency "pear.phpunit.de/File_Iterator" has no releases
Unknown remote channel: components.ez.no
Package "pear.phpqatools.org/PHP_CodeBrowser" dependency "pear.phpunit.de/File_Iterator" has no rel
eases
Failed to download pear/Text_Highlighter within preferred state "stable", latest release is version
 0.7.3, stability "beta", use "channel://pear.php.net/Text_Highlighter-0.7.3" to install
Package "pear.phpqatools.org/PHP_CodeBrowser" dependency "pear.phpunit.de/PHPUnit" has no releases
Package "pear.phpqatools.org/PHP_CodeBrowser" dependency "pear.php.net/PhpDocumentor" has no releas
es
Package "pear.php.net/PHP_CodeSniffer" dependency "pear.phpunit.de/PHP_Timer" has no releases
Package "pear.phpunit.de/DbUnit" dependency "pear.phpunit.de/PHPUnit" has no releases
Package "pear.phpunit.de/DbUnit" dependency "pear.symfony-project.com/YAML" has no releases
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
WARNING: "pear/Auth_SASL" is deprecated in favor of "pear/Auth_SASL2"
phpqatools/phpqatools requires package "channel://pear.pdepend.org/PHP_Depend"
phpqatools/phpqatools requires package "channel://pear.phpmd.org/PHP_PMD"
phpunit/PHPUnit_SkeletonGenerator requires package "channel://components.ez.no/ConsoleTools" (versi
on >= 1.6)
phpunit/phpcpd requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/phploc requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/phploc can optionally use PHP extension "bytekit"
phpqatools/PHP_CodeBrowser can optionally use package "pear/Text_Highlighter" (version >= 0.7.1)
downloading PHP_CodeBrowser-1.0.3.tgz ...
Starting to download PHP_CodeBrowser-1.0.3.tgz (172,253 bytes)
.....................................done: 172,253 bytes
downloading PHP_CodeSniffer-1.3.6.tgz ...
Starting to download PHP_CodeSniffer-1.3.6.tgz (352,931 bytes)
...done: 352,931 bytes
downloading DbUnit-1.1.2.tgz ...
Starting to download DbUnit-1.1.2.tgz (41,895 bytes)
...done: 41,895 bytes
downloading Console_CommandLine-1.1.3.tgz ...
Starting to download Console_CommandLine-1.1.3.tgz (38,507 bytes)
...done: 38,507 bytes
downloading Log-1.12.7.tgz ...
Starting to download Log-1.12.7.tgz (46,898 bytes)
...done: 46,898 bytes
downloading DB-1.7.14.tgz ...
Starting to download DB-1.7.14.tgz (133,103 bytes)
...done: 133,103 bytes
downloading MDB2-2.4.1.tgz ...
Starting to download MDB2-2.4.1.tgz (119,790 bytes)
...done: 119,790 bytes
downloading Mail-1.2.0.tgz ...
Starting to download Mail-1.2.0.tgz (23,214 bytes)
...done: 23,214 bytes
downloading Net_SMTP-1.6.1.tgz ...
Starting to download Net_SMTP-1.6.1.tgz (13,164 bytes)
...done: 13,164 bytes
ERROR: failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File
ERROR: failed to mkdir C:\php\pear\docs\DbUnit\Samples\BankAccountDB\_files
ERROR: failed to mkdir C:\php\pear\data\Console_CommandLine\data
ERROR: failed to mkdir C:\php\pear\docs\Log\docs
ERROR: failed to mkdir C:\php\pear\docs\DB\doc
ERROR: failed to mkdir C:\php\pear\docs\MDB2\docs\examples
ERROR: failed to mkdir C:\php\pear\tests\Mail\tests
ERROR: failed to mkdir C:\php\pear\docs\Net_SMTP\docs
ERROR: failed to mkdir C:\php\pear\data\PHP_CodeBrowser\templates\css

I don't understand why install tries to mkdir on C:\php\pear\and also how to solve problems with unknown remove channels...

我不明白为什么 install 尝试 mkdir onC:\php\pear\以及如何解决未知删除通道的问题......

回答by edorian

The only way I found to get pear working when using Xamp is do delete the folder and reinstall it from scratch. The pear client (for a long time the very very broken 1.9.2 version) doesn't work properly even when in the excepted location but there is no sane way to fix it when you install xamp somewhere else as the path is set in way to many files.

我发现在使用 Xamp 时让 pear 工作的唯一方法是删除文件夹并从头开始重新安装。pear 客户端(很长一段时间是非常非常破碎的 1.9.2 版本)即使在例外位置也无法正常工作,但是当您在其他地方安装 xamp 时,没有合理的方法来修复它,因为路径设置为到许多文件。

Follow the guide on http://pear.php.net/manual/en/installation.getting.php.

按照http://pear.php.net/manual/en/installation.getting.php上的指南进行操作。

Download http://pear.php.net/go-pear.phar, execute it, select systemwide install and adapt all the pathes to your location.

下载 http://pear.php.net/go-pear.phar,执行它,选择system广泛安装并根据您的位置调整所有路径。

Once that is working and pear versionreports 1.9.4use

一旦工作并pear version报告1.9.4使用

pear config-set auto_discover 1
pear install --force --alldeps pear.phpqatools.org/phpqatools

to "fix" anything the old installation left over.

“修复”旧安装遗留的任何东西。



Just using that version of pear should fix all your Package and channel troubles too.

仅仅使用那个版本的 pear 也应该可以解决你所有的 Package 和 channel 问题。

It it, for some reason, doesn't use

它,出于某种原因,不使用

pear channel-discover $everyChannelThatDoesNotWork
pear channel-update $thatChannel

for everything that gets reported as a problem.

对于被报告为问题的所有内容。

回答by Joery

If, like it was for me, running all the pear config-set commands still result in this error:

如果像我一样,运行所有 pear config-set 命令仍然会导致此错误:

failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File

无法 mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File

then there is a simple solution which took me a while to figure out:

然后有一个简单的解决方案,我花了一段时间才弄清楚:

Run your terminal as administrator

以管理员身份运行终端

Really, thats the solution. Then like others said: goto c:\xampp\php in your terminal and type following commands:

真的,这就是解决方案。然后就像其他人说的:在终端中转到 c:\xampp\php 并键入以下命令:

pear config-set doc_dir C:\xampp\php\pear\docs
pear config-set cfg_dir C:\xampp\php\pear\cfg
pear config-set data_dir C:\xampp\php\pear\data
pear config-set man_dir C:\xampp\php\local\man
pear config-set test_dir C:\xampp\php\pear\tests
pear config-set www_dir C:\xampp\php\pear\www

pear install PHP_CodeSniffer

回答by W?odzimierz Gajda

Try to correct the config paths with following commands:

尝试使用以下命令更正配置路径:

pear config-show

pear config-create / C:\xampp\php\pear.ini

pear -c c:\xampp\php\pear.ini config-set doc_dir c:\xampp\php\pear\docs
pear -c c:\xampp\php\pear.ini config-set bin_dir c:\xampp\php
pear -c c:\xampp\php\pear.ini config-set ext_dir c:\xampp\php\ext
pear -c c:\xampp\php\pear.ini config-set php_dir c:\xampp\php\pear
pear -c c:\xampp\php\pear.ini config-set cache_dir c:\xampp\php\cache
pear -c c:\xampp\php\pear.ini config-set cfg_dir c:\xampp\php\cfg
pear -c c:\xampp\php\pear.ini config-set data_dir c:\xampp\php\data
pear -c c:\xampp\php\pear.ini config-set download_dir c:\xampp\php\download
pear -c c:\xampp\php\pear.ini config-set php_bin c:\xampp\php\php.exe
pear -c c:\xampp\php\pear.ini config-set temp_dir c:\xampp\php\tmp
pear -c c:\xampp\php\pear.ini config-set test_dir c:\xampp\php\pear\tests
pear -c c:\xampp\php\pear.ini config-set www_dir c:\xampp\php\pear\www

pear -c c:\xampp\php\pear.ini config-show

Every pear command should use -c c:\xampp\php\pear.iniparameter, for example:

每个 pear 命令都应该使用-c c:\xampp\php\pear.ini参数,例如:

pear -c c:\xampp\php\pear.ini config-set auto_discover 1
pear -c c:\xampp\php\pear.ini install pear.phpqatools.org/phpqatools

回答by user3077917

No need to delete the PEAR cache manually

无需手动删除 PEAR 缓存

pear clear-cache 

clears the pear cache without having to go searching for the cache manually.

清除梨缓存,而无需手动搜索缓存。

This solved the response I was getting when trying to download packages from the Structures channel which was

这解决了我在尝试从 Structures 频道下载包时得到的响应

 no release for package ....

which indicated to me that pear had no new release for that particular package which had already been recorded as being on my system, although not successfully installed.

这向我表明 pear 没有针对该特定软件包的新版本,该软件包已被记录为在我的系统上,尽管没有成功安装。

Also changing the preferred statefrom stable to devel using

还使用以下方法将首选状态从稳定更改为开发

pear config-set preferred_state devel

allowed installation of all the packages I required, most of which are either devel or alpha

允许安装我需要的所有软件包,其中大部分是 devel 或 alpha

Hope this helps someone from wasting nearly a day that this has cost me getting to the bottom of why I was getting the "No releases" response.

希望这可以帮助某人避免浪费将近一天的时间,这让我无法弄清楚为什么我会收到“无发布”响应。

回答by Ivo

Pear isn't configured properly. I remember XAMPP's install of pear not working out of the box.

Pear 配置不正确。我记得 XAMPP 安装的梨没有开箱即用。

See herefor guidance on how to set the required variables properly. Find the ones that are set to a default value, like C:\php\<something>and change them to folders in XAMPP's pear/php installation.

有关如何正确设置所需变量的指导,请参见此处。找到设置为默认值的那些,例如C:\php\<something>并将它们更改为 XAMPP 的 pear/php 安装中的文件夹。