Laravel: Lacking mcrypt extension only when using phpunit

微笑、不失礼 提交于 2019-12-12 23:01:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!