我最近使用pear package安装程序按照文档中的指示安装了PHPUnit。 Pear目前安装在/usr/local/lib/php/pear
。但是,PHPUnit似乎将自己安装到/usr/share/pear
中,因此当我尝试运行phpunit --version
或phpunit --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
这是以root身份运行时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/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
答案 0 :(得分:2)
好吧,好像我们找到了问题(见评论)。
我认为PHPUnit
是以root身份安装的,或者梨因为某些原因选择了“root”配置目录。
放置代码的路径在:
中定义 PEAR directory php_dir /usr/share/pear
因此,梨配置中的某些内容似乎是个问题。
如果可能,我会pear config-set php_dir $yourLocation
并查看它是否有效。
It is possible to install multiple versions of PHPUnit
使用帖子中描述的pear install --installroot /some/path/
。所以无论如何都应该解决。