如何在雪豹 10.6.7 上使用 MAMP 安装 phpunit

发布于 2024-10-30 23:18:18 字数 1430 浏览 2 评论 0原文

我一直尝试在 Mac OS X 10.6.7 上使用 MAMP 1.9.5 安装 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

我已经尝试了这篇文章中的每一个建议 如何安装phpunit 3.5 在 mac 上使用 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();

有人知道发生了什么吗?

非常感谢你。

I've been trying to install phpunit on Mac OS X 10.6.7 with MAMP 1.9.5 with no luck.
It's correctly installed, but when I execute it, it doesn't do anything, no output, nothing.

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

I've tried every proposition from this post How to Install phpunit 3.5 on mac with MAMP , but nothings seems to work for me.

Here is my phpunit content :

#!/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();

Does anyone has an idea of what's going on ?

Thanks you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑忘罢 2024-11-06 23:18:18

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

我确实有类似的问题,多亏了这个线程,我设法解决了它。
我是这样做的:
遵循 edorian 建议:

重新安装 pear

我找到的唯一方法是
重新安装保存
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

我可以看到有两个配置文件,一个用于系统,一个用于用户(请参阅 config-show.php 的底部)。

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

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

Following edorian suggestion, I've been to the other thread and found the solution :
restore the system settings for pear, as I probably messed with user settings. Here is the complete solution if anyone needs it :

I did have a similar issue, thanks to this thread I managed to fix it.
Here is how I did it :
Followed edorian suggestion :

Reinstalling pear

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

Then called pear config-show to see this :

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

I could see there was two config files one for the system and one for the user (see a the bottom of the config-show.

I backed up my user conf file and replaced it by the system one. Then I needed to set the php_ini setting to /Applications/MAMP/conf/php5.3/php.ini (seemed to be absent from the system config file).

After that my phpunit worked again!
Thanks to everyone :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文