简体   繁体   English

在OSX Leopard上正确安装PHPUnit和Pear

[英]Install PHPUnit and Pear correctly on OSX Leopard

I've installed pear using this guide http://t-machine.org/index.php/2008/12/28/how-to-install-pear-on-os-x-105/ 我已经使用本指南http://t-machine.org/index.php/2008/12/28/how-to-install-pear-on-os-x-105/安装了pear

In /etc/php.ini my include_path = ".:/usr/local/PEAR" /etc/php.ini中,我的include_path =“。:/ usr / local / PEAR”

PHPUnit is installed under /usr/local/PEAR/PHPUnit using sudo pear install phpunit/PHPUnit (I get an error otherwise) 使用sudo pear install phpunit / PHPUnit将 PHPUnit安装在/ usr / local / PEAR / PHPUnit下 (否则会出现错误)

Yet when I try execute phpunit I'm getting this error 但是,当我尝试执行phpunit时,出现此错误

Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: Not a directory in /usr/local/bin/phpunit on line 44

Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php' (include_path='.:') in /usr/local/bin/phpunit on line 44

I'm just wondering has anyone got an idea of what the problem is or a complete(and correct guide) on installing pear osx. 我只是想知道是否有人知道问题是什么或安装pear osx的完整(正确指南)。

Thanks! 谢谢!

Just a quick guess, that could be wrong, but perhaps you may need to add a trailing slash to the path like this: include_path = ".:/usr/local/PEAR/" 快速猜测,这可能是错误的,但是也许您可能需要在路径中添加斜杠,如下所示: include_path = ".:/usr/local/PEAR/"

Edit: somehow /usr/local/PEAR is not in your include path as (include_path='.:') in your error message shows. 编辑:/ usr / local / PEAR 不在您的错误消息显示中的(include_path='.:')包含路径中。

Solved the problem I had a stupid ; 解决了我愚蠢的问题; before the include_path statement! 在include_path语句之前!

I am aware I'm an idiot, many thanks. 我知道我是个白痴,非常感谢。 :) :)

If you're like me and none of these solutions were quite right, I'll share my solution. 如果您像我一样,但这些解决方案都不对,我将分享我的解决方案。 For some reason of which I lack the current knowledge to understand, on my Mac config, PHPUnit was reading the php.ini located in /etc/php.ini rather than the php.ini I thought it was reading located in /Applications/MAMP/conf/php5/php.ini. 由于某些原因,我缺乏当前了解的知识,在我的Mac配置中,PHPUnit正在读取/etc/php.ini中的php.ini,而不是我认为其位于/ Applications / MAMP中的php.ini。 /conf/php5/php.ini。

In the former, my path was /usr/share/pear. 在前者中,我的路径是/ usr / share / pear。 In the latter, it was usr/local/pear. 在后者中,它是usr / local / pear。 Changing the former file to match the latter and rerunning phpunit resulted in 更改前一个文件以匹配后者并重新运行phpunit导致

phpunit StackTest.php 
PHPUnit 3.4.5 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 3.50Mb

OK (1 test, 5 assertions)

Hope this helps someone else. 希望这对其他人有帮助。

Try changing that to be: 尝试将其更改为:


require_once("../../PHPUnit/Util/Filter.php");

If you look at the error, it shows that you are trying to access the wrong directory. 如果查看错误,则表明您正在尝试访问错误的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM