【问题标题】:PHPUnit being installed to the wrong directoryPHPUnit 安装到错误的目录
【发布时间】:2012-01-14 07:50:04
【问题描述】:

我最近按照文档中的说明使用 pear 包安装程序安装了 PHPUnit。 Pear 目前安装在/usr/local/lib/php/pear。但是,PHPUnit 似乎正在将自身安装到 /usr/share/pear 中,因此当我尝试运行 phpunit --versionphpunit --help 时出现包含错误。

我看到了三种可能的解决方案,但如果我选错了,我怕以后会遇到问题。以下是可能的解决方案:(A) 将 PHPUnit 目录从 /usr/share/pear/PHPUnit 移动到 /usr/local/lib/php/pear/PHPUnit,(B) 将 PHPUnit 目录移动到 /usr/local/lib/php/pear/share/pear/PHPUnit,或者 (C) 使用一些额外的命令或开关重新安装 phpunit,以获取它安装到合适的位置?

提前感谢您的帮助。

更新:这是pear config-show 在我的用户名下运行时的输出:

Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels     auto_discover    1
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          /usr/bin
PEAR documentation directory   doc_dir          /usr/local/lib/php/pear/docs
PHP extension directory        ext_dir          /usr/lib64/php/modules
PEAR directory                 php_dir          /usr/local/lib/php
PEAR Installer cache directory cache_dir        /tmp/pear/cache
PEAR configuration file        cfg_dir          /usr/share/pear/cfg
directory
PEAR data directory            data_dir         /usr/local/lib/php/pear/data
PEAR Installer download        download_dir     /tmp/pear/download
directory
PHP CLI/CGI binary             php_bin          /usr/bin/php
php.ini location               php_ini          <not set>
--program-prefix passed to     php_prefix       <not set>
PHP's ./configure
--program-suffix passed to     php_suffix       <not set>
PHP's ./configure
PEAR Installer temp directory  temp_dir         /tmp/pear/temp
PEAR test directory            test_dir         /usr/local/lib/php/pear/tests
PEAR www files directory       www_dir          /usr/share/pear/www
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  stable
Unix file mask                 umask            27
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          /usr/bin/gpg
Signature Key Directory        sig_keydir       /etc/pearkeys
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         <not set>
maintainers)
User Configuration File        Filename         /home/webdeveloper/.pearrc
System Configuration File      Filename         /etc/pear.conf

下面是pear config-show 以 root 身份运行时的输出:

Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels     auto_discover    1
Default Channel                default_channel  pear.php.net
HTTP Proxy Server Address      http_proxy       <not set>
PEAR server [DEPRECATED]       master_server    pear.php.net
Default Channel Mirror         preferred_mirror pear.php.net
Remote Configuration File      remote_config    <not set>
PEAR executables directory     bin_dir          /usr/bin
PEAR documentation directory   doc_dir          /usr/share/pear/docs
PHP extension directory        ext_dir          /usr/lib64/php/modules
PEAR directory                 php_dir          /usr/share/pear
PEAR Installer cache directory cache_dir        /tmp/pear/cache
PEAR configuration file        cfg_dir          /usr/share/pear/cfg
directory
PEAR data directory            data_dir         /usr/share/pear/data
PEAR Installer download        download_dir     /tmp/pear/download
directory
PHP CLI/CGI binary             php_bin          /usr/bin/php
php.ini location               php_ini          <not set>
--program-prefix passed to     php_prefix       <not set>
PHP's ./configure
--program-suffix passed to     php_suffix       <not set>
PHP's ./configure
PEAR Installer temp directory  temp_dir         /tmp/pear/temp
PEAR test directory            test_dir         /usr/share/pear/tests
PEAR www files directory       www_dir          /usr/share/pear/www
Cache TimeToLive               cache_ttl        3600
Preferred Package State        preferred_state  stable
Unix file mask                 umask            22
Debug Log Level                verbose          1
PEAR password (for             password         <not set>
maintainers)
Signature Handling Program     sig_bin          /usr/bin/gpg
Signature Key Directory        sig_keydir       /etc/pearkeys
Signature Key Id               sig_keyid        <not set>
Package Signature Type         sig_type         gpg
PEAR username (for             username         <not set>
maintainers)
User Configuration File        Filename         /root/.pearrc
System Configuration File      Filename         /etc/pear.conf

【问题讨论】:

  • 你的梨好像有问题。你可以添加pear config-show 的输出吗?
  • PEAR 被配置为将其配置文件和 www 文件放在/usr/share/pear 中,而其他所有内容都放在/usr/local/lib/php 下,这似乎很奇怪。对我来说(Ubuntu 11.04)一切都在/usr/share/php之下。你是如何安装 PHP 和 PEAR 的?您使用的是什么发行版?
  • @DavidHarkness 我们的旧系统管理员安装了 php,最初配置为 --without-pear。我与新的系统管理员一起将 pear(按照 pear 手册说明)安装到 /usr/local/lib/php/pear 中,如果我们错过了一个默认为 /usr/share/pear 的选项,我不会感到惊讶。我们正在运行 Red Hat Enterprise Linux AS 第 4 版(Nahant Update 9)。
  • 嗯,目前看来配置还不错。您使用以 root 身份安装 pear 包,config-show 的输出也是来自 root 帐户吗?
  • @edorian 哎呀,这是config-show 我的帐户而不是root 的输出。它以 root 身份安装。我会尽快让我们的系统管理员运行它并将结果发送给我。

标签: php linux installation phpunit pear


【解决方案1】:

好吧,看来我们找到了问题(见 cmets)。

我假设PHPUnit 是作为 root 安装的,或者 pear 出于某种原因选择了“roots”配置目录。

放代码的路径定义在:

 PEAR directory  php_dir /usr/share/pear

所以 pear 配置中的某些东西似乎是问题所在。

如果可能的话,我会 pear config-set php_dir $yourLocation 看看它是否可行。


It is possible to install multiple versions of PHPUnit 使用pear install --installroot /some/path/,如帖子中所述。所以无论如何都应该解决。

【讨论】:

    猜你喜欢
    • 2011-09-29
    • 2010-11-24
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    相关资源
    最近更新 更多