如何在雪豹 10.6.7 上使用 MAMP 安装 phpunit
我一直尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据edorian的建议,我去了另一个线程并找到了解决方案:
恢复 pear 的系统设置,因为我可能弄乱了用户设置。如果有人需要的话,这是完整的解决方案:
我确实有类似的问题,多亏了这个线程,我设法解决了它。
我是这样做的:
遵循 edorian 建议:
然后调用
pear config-show
来查看:我可以看到有两个配置文件,一个用于系统,一个用于用户(请参阅 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 :
Then called
pear config-show
to see this :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 :)