问题
I have a following problem - when using phpunit
in my Laravel 4 installation folder I get a following error:
Laravel requires the Mcrypt PHP extension.
However it does not appear when I'm using the artisan
command. I know that the issue must be caused by phpunit loading another php.ini than the one set in my zshconfig.
Unfortunately I don't know how to force phpunit to use the correct one.
My .zshconfig looks like this:
# Customize to your needs...
export PATH=:/Applications/MAMP/Library/bin/:/Users/jacekbandura/pear/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin/:/Users/jacekbandura/nasm
export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
I'm using OS X 10.8.4 and MAMP.
Has anyone solved this problem before? Thanks in advance :)
回答1:
Here are some install notes from PHPUnit and an article. Did you install phpunit via composer? Or did you install it another way?
Here are some install directions, hopefully one matches your use case.
PhpUnit docs point towards editing a phpunit file and setting the path to the php binary directly
This article points towards installing PhpUnit with PECL and shows taking a setp to change the PHP executable you'll be using
This SO answer points towards using Composer, but setting some specific config
来源:https://stackoverflow.com/questions/18694866/laravel-lacking-mcrypt-extension-only-when-using-phpunit