views:

1850

answers:

4

Hey all,

I've installed pear using this guide 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"

PHPUnit is installed under /usr/local/PEAR/PHPUnit using sudo pear install phpunit/PHPUnit(I get an error otherwise)

Yet when I try execute phpunit I'm getting this error

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.

Thanks!

+2  A: 

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/"

Edit: somehow /usr/local/PEAR is not in your include path as (include_path='.:') in your error message shows.

Residuum
A: 

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.

Thomas
+1  A: 

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

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

Shane
A: 

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.

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

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.

Mike