安装Phing& MAMP上的PHPUnit [英] Installing Phing & PHPUnit on MAMP
问题描述
我在OS X 10.6上的MAMP下运行phpunit时遇到问题.我已经通过PEAR安装了phpunit,它存在于MAMP目录中,但是当我在终端中运行phpunit时,什么也没发生.我猜这是一个路径问题,但是作为os x新手,我不知道如何解决它.这是当我尝试从/Applications/MAMP/bin/php5.3/bin
I'm having problems running phpunit under MAMP on OS X 10.6. I've installed phpunit via PEAR and it is exists in the MAMP directory but when I run phpunit in terminal nothing happens. I'm guessing that this is a path problem but as a os x newbie, I don't know how to fix it. This is what happens when I try to run it from /Applications/MAMP/bin/php5.3/bin
$ phpunit
-bash: /usr/bin/phpunit: No such file or directory
$ ./phpunit
$
问题看起来非常类似于以下如何在装有MAMP的Mac上安装phpunit 3.5 ,但到目前为止,该解决方案尚未奏效.这是更多系统信息:
The problem looks very similar to this How to Install phpunit 3.5 on mac with MAMP but the solutions there haven't worked so far. Here is some more system info:
phpunit在MAMP中的位置
Location of phpunit in MAMP
$ sudo find / -name "phpunit"
/Applications/MAMP/bin/php5.3/bin/phpunit
/Applications/MAMP/bin/php5.3/lib/php/PEAR/phing/tasks/ext/phpunit
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
可能是这里的问题
$ which php
/usr/bin/php
$ which phpunit
$ which pear
$ which ./pear
./pear
$ which ./phpunit
./phpunit
我的php.ini来自/Applications/MAMP/conf/php5.3/php.ini
My php.ini from /Applications/MAMP/conf/php5.3/php.ini
include_path = ".:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/bin/php5.3/lib/php/PEAR/"
尝试运行或访问网络钓鱼时也会发生相同的问题.
The same issues happen when trying to run or access phing.
因此,我再次猜到问题是路径设置,但是我不确定如何解决此问题.
So again, I'm guessing the problem is a path setting but I'm not sure how to fix this.
谢谢
戴夫
更新
感谢您的回复. 我的梨是1.9.2 pear配置显示列表
thanks for your response. My pear is 1.9.2 pear config show lists
$ ./pear config-show
Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover <not set>
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 /Applications/MAMP/bin/php5.3/bin
PEAR documentation directory doc_dir /Applications/MAMP/bin/php5.3/lib/php/doc
PHP extension directory ext_dir /Applications/MAMP/bin/php5.3/lib/php/extensions
PEAR directory php_dir /Applications/MAMP/bin/php5.3/lib/php/PEAR
PEAR Installer cache directory cache_dir /tmp/pear/cache
PEAR configuration file cfg_dir /Applications/MAMP/bin/php5.3/lib/php/cfg
directory
PEAR data directory data_dir /Applications/MAMP/bin/php5.3/lib/php/data
PEAR Installer download download_dir /tmp/pear/cache
directory
PHP CLI/CGI binary php_bin /Applications/MAMP/bin/php5.3/bin/php
php.ini location php_ini /Applications/MAMP/conf/php5.3/php.ini
--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 /Applications/MAMP/bin/php5.3/lib/php/test
PEAR www files directory www_dir /Applications/MAMP/bin/php5.3/lib/php/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/local/bin/gpg
Signature Key Directory sig_keydir /Applications/MAMP/conf/php5.3/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 /Users/dave/.pearrc
System Configuration File Filename /Applications/MAMP/conf/php5.3/pear.conf'
/p/Applications/MAMP/bin/php5.3/bin中的
ls -al列出了phpunit等
ls -al of /Applications/MAMP/bin/php5.3/bin lists phpunit amongst others
-rwxr-xr-x 1 dave admin 920 6 Apr 19:55 phing
-r-xr-xr--@ 1 dave admin 57583340 16 Feb 16:08 php
-rwxr-xr-x 1 dave admin 2169 6 Apr 19:48 phpunit
如上所述,php.ini似乎列出了正确的位置并回显$ PATH生成的
As noted above, the php.ini seems to list the correct location and echo $PATH generates
$ echo $PATH
/Applications/MAMP/bin/php5.3/bin:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/bin/php5.3/lib/php/PEAR/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
推荐答案
让我尝试一下通用phpunit安装故障排除列表"中的内容. (从来没有写下来,所以我无法将您链接到任何东西.)
Let my try with what I've come to thing of the "generic phpunit install troubleshooting list". (Never written that down before so i can't link you to anything).
首先请确保
pear version
至少报告pear 1.9.2
.如果不是,请按pear install --force pear/pear
并再次检查.如果那不起作用,我剩下的唯一想法就是重新安装pear.见下文.
reports at least pear 1.9.2
. If not: pear install --force pear/pear
and check again. If that doesn't work the only Idea I've got left is to reinstall pear. See below.
在此过程中收到的有关需要频道升级"的任何消息都非常重要,您应该执行建议的命令.
Any messages about "needed channel upgrades" you will get in the process are important and you should execute the suggested commands.
然后尝试:
pear install phpunit/phpunit --force --alldeps
重复此操作,直到不再抱怨缺少频道或频道升级为止.
and repeat that until it stops complaining about missing channels or channel upgrades.
即使pear version
显示1.9.2,它 still 仍可能抱怨需要PEAR 1.9.2.我只能通过重新安装pear来解决此问题.
It still might complain about needing PEAR 1.9.2 even when pear version
shows 1.9.2. I could only solve this by reinstalling pear.
重新安装梨
我找到的唯一途径是重新安装保存 http://pear.php.net /go-pear.phar 通过另存为..."到磁盘并运行php go-pear.phar
The only way i found arround that is To reinstall save http://pear.php.net/go-pear.phar to disk via 'Save as...' and run php go-pear.phar
还没有运气吗?
pear config-show
并查找可执行目录"
如果该目录中没有"phpunit" binary ,请重新检查安装是否有效,以及是否没有告诉我们有关错误消息的信息:)
If there is no "phpunit" binary in that directory recheck that the installing worked and if it didn't tell us about the error message :)
二进制文件存在,但which phpunit
不起作用
Binary is there but which phpunit
doesn't work
确保可执行文件目录位于$ PATH中,或使用绝对路径查看其是否有效
Make sure that executable directory is in your $PATH or use the absolute path to see if it works
它已执行,但存在有关缺少组件的错误
确保PEAR directory
(php_dir
)是您的php.ini的include_path
Make sure the PEAR directory
(php_dir
) is your php.ini's include_path
如果您再遇到麻烦,请让我知道发生了什么问题,我将尽力调整答案.
If you run into any more troubles let me/us know what went wrong and I'll try to adapt the answer.
这篇关于安装Phing& MAMP上的PHPUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!