在OSX Leopard上正确安装PHPUnit和Pear

时间:2022-10-08 07:07:12

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/

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)

PHPUnit使用sudo pear install 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.

我只是想知道有没有人知道问题是什么或安装梨osx的完整(和正确的指南)。

Thanks!

4 个解决方案

#1


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路径中(include_path =':')。

#2


Solved the problem I had a stupid ; before the include_path statement!

解决了我愚蠢的问题;在include_path语句之前!

I am aware I'm an idiot, many thanks. :)

我知道我是个白痴,非常感谢。 :)

#3


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. In the latter, it was usr/local/pear. Changing the former file to match the latter and rerunning phpunit resulted in

在前者中,我的路径是/ usr / share / pear。在后者,它是usr / local / pear。更改以前的文件以匹配后者并重新运行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.

希望这有助于其他人。

#4


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.

如果查看错误,则表明您正在尝试访问错误的目录。

#1


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路径中(include_path =':')。

#2


Solved the problem I had a stupid ; before the include_path statement!

解决了我愚蠢的问题;在include_path语句之前!

I am aware I'm an idiot, many thanks. :)

我知道我是个白痴,非常感谢。 :)

#3


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. In the latter, it was usr/local/pear. Changing the former file to match the latter and rerunning phpunit resulted in

在前者中,我的路径是/ usr / share / pear。在后者,它是usr / local / pear。更改以前的文件以匹配后者并重新运行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.

希望这有助于其他人。

#4


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.

如果查看错误,则表明您正在尝试访问错误的目录。