【问题标题】:How to install phpunit with MAMP on snow leopard 10.6.7如何在雪豹 10.6.7 上使用 MAMP 安装 phpunit
【发布时间】:2011-04-08 16:43:25
【问题描述】:

我一直在尝试使用 MAMP 1.9.5 在 Mac OS X 10.6.7 上安装 phpunit,但没有成功。 它已正确安装,但是当我执行它时,它什么也不做,没有输出,什么都没有。

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();

有人知道发生了什么吗?

非常感谢。

【问题讨论】:

标签: php macos osx-snow-leopard phpunit


【解决方案1】:

按照 edorian 的建议,我去过另一个线程并找到了解决方案: 恢复梨的系统设置,因为我可能弄乱了用户设置。如果有人需要,这里是完整的解决方案:

我确实遇到了类似的问题,感谢这个帖子我设法解决了它。 这是我的做法: 遵循edorian的建议:

重新安装梨

我发现的唯一方法是 重新安装保存 http://pear.php.net/go-pear.phar 到 通过“另存为...”磁盘并运行 php go-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

我可以看到有两个配置文件,一个用于系统,一个用于用户(请参阅配置显示的底部。

我备份了我的用户配置文件并将其替换为系统配置文件。然后我需要将 php_ini 设置设置为 /Applications/MAMP/conf/php5.3/php.ini (系统配置文件中似乎没有)。

在那之后我的 phpunit 又工作了! 谢谢大家:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-30
    • 2010-12-09
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多