Reputation: 697
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!
Upvotes: 1
Views: 6137
Reputation: 2778
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.
Upvotes: 1
Reputation: 697
Solved the problem I had a stupid ; before the include_path statement!
I am aware I'm an idiot, many thanks. :)
Upvotes: 4
Reputation: 4999
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.
Upvotes: 0
Reputation: 12064
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.
Upvotes: 5