2011-04-08 77 views
0

我一直試圖在Mac OS X 10.6.7上用MAMP 1.9.5安裝phpunit,但沒有運氣。 它已正確安裝,但是當我執行它時,它不會執行任何操作,也不會執行任何操作。如何在雪豹上安裝帶有MAMP的phpunit 10.6.7

bash-3.2# php -i | grep include_path 
include_path => .:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/bin/php5.3/lib/php/PEAR/PHPUnit => .:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/bin/php5.3/lib/php/PEAR/PHPUnit 
bash-3.2# which php 
/Applications/MAMP/bin/php5.3/bin/php 
bash-3.2# which phpunit 
/Applications/MAMP/bin/php5.3/bin/phpunit 
bash-3.2# which pear 
/Applications/MAMP/bin/php5.3/bin/pear 
bash-3.2# phpunit 
bash-3.2# phpunit --version 
bash-3.2# phpunit --help 

我試過這個職位How to Install phpunit 3.5 on mac with MAMP每一個命題,但沒有任何事情似乎爲我工作。

這是我PHPUnit的內容:

#!/Applications/MAMP/bin/php5.3/bin/php 
<?php 
/* PHPUnit 
* 
*/ 

require_once 'PHP/CodeCoverage/Filter.php'; 
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT'); 

if (extension_loaded('xdebug')) { 
    xdebug_disable(); 
} 

if (strpos('/Applications/MAMP/bin/php5.3/bin/php', '@php_bin') === 0) { 
    set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); 
} 

require_once 'PHPUnit/Autoload.php'; 

define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main'); 

PHPUnit_TextUI_Command::main(); 

任何人不會有什麼事情的想法?

非常感謝。

+1

在那裏似乎有一個非常類似的問題:http://stackoverflow.com/questions/5588613/installing-phing-phpunit-on-mamp也許你可能有任何運氣: / – edorian 2011-04-08 16:59:14

回答

0

以下edorian建議,我去過其他線程,發現解決方案: 恢復梨的系統設置,因爲我可能與用戶設置搞砸了。這裏是完整的解決方案,如果有人需要它:

我也有類似的問題,感謝這個線程,我設法解決它。 這是我如何做的: 其次edorian建議:

重新安裝梨

我發現角落找尋那唯一的辦法是 要通過重新安裝保存 http://pear.php.net/go-pear.phar到 盤「另存爲...」並運行PHP 去-pear.phar

然後叫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   /Users/mbritto/pear/bin 
PEAR documentation directory doc_dir   /Users/mbritto/pear/docs 
PHP extension directory  ext_dir   /Applications/MAMP/bin/php5.3/lib/php/extensions 
PEAR directory     php_dir   /Users/mbritto/pear/share/pear 
PEAR Installer cache directory cache_dir  /tmp/pear/cache 
PEAR configuration file  cfg_dir   /Users/mbritto/pear/cfg 
directory 
PEAR data directory   data_dir   /Users/mbritto/pear/data 
PEAR Installer download  download_dir  /tmp/pear/install 
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/install 
PEAR test directory   test_dir   /Users/mbritto/pear/tests 
PEAR www files directory  www_dir   /Users/mbritto/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/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/mbritto/.pearrc 
System Configuration File  Filename   /Applications/MAMP/conf/php5.3/pear.conf 

我可以看到有兩個配置文件一個用於系統,另一個用於用戶(請參閱config-show的底部。

我備份了我的用戶配置文件,並由系統替換它。然後,我需要將php_ini設置設置爲/Applications/MAMP/conf/php5.3/php.ini(似乎不存在於系統配置文件中)。

之後,我的phpunit再次工作! 感謝大家:)