PHPUnit Fails Silently, Returning Code 255
specs/ (dev) $ phpunit . specs/ (dev) $ echo $? 255
No errors output, and phpunit is returning code 255. It took me forever to figure out what this meant and none of the search results in google were helping either. I finally realized the issue today.
PHPUnit was encountering a php error. While I thought I had
enabled in my
php.ini. A few days later, I realized I had
Off. If you want to see what’s going on you have to set
Now I am getting more meaningful output (truncated):
Warning: require_once(PHPUnit/Framework.php): failed to open stream: No such file or directory Fatal error: require_once(): Failed opening required 'PHPUnit/Framework.php' (include_path='.:/Applications/MAMP/bin/php/php5.2.17/lib/php/PHPUnit:/Applications/MAMP/bin/php/php5.2.17/lib/php:/Users/gmcquillan/Sites/ZendFramework-1.10.6/library/')
Which I thought meant it’s not finding my PHPUnit library in my php include path.
I tried finagling with my
include_path for quite a while.
According to the output it was searching in the right spot, but still not coming
up for some reason. I eventually figured out that the cause of this issue was a
require_once statement that I had at the top of my unit test code file:
When I looked in my PHPUnit directory I noticed this file did not exist, so it must have been a difference between the version of PHPUnit I was using previously and the current version.
Here are some quick wins to help you solve your issue:
php.ini(In MAMP 2.0.5 that’s in
/Applications/MAMP/bin/php/php5.2.17/conf/php.iniand of course if you’re using php 5.3 you should be editing the one in your php5.3 directory
- Check the
Once you are able to see the error message output, the problem should be very clear. When changing php.ini the cli php will see changes immediately (unlike apache where you will have to restart the server for changes to take effect)
blog comments powered by Disqus