问题描述
我正在Mac上开始使用laravel,并正在使用MAMP.我在laravel中使用`artisan'命令.
I am getting started with using laravel on Mac and am using MAMP. I am using the `artisan' command with laravel in php.
php artisan migrate:make create_users_table --table=users --create
但这给了我这个错误
php artisan migrate:make create_users_table --table=users --create
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so, 9): image not found in Unknown on line 0
Laravel requires the Mcrypt PHP extension.
我已经为PHP安装了mcrypt扩展.
I have installed the mcrypt extension for PHP.
brew install php53-mcrypt
这会给我一条消息,提示它已经安装:php53-mcrypt-5.3.26 already installed
This gives me a message saying that it is already installed: php53-mcrypt-5.3.26 already installed
推荐答案
在命令行中运行的PHP与通过Web服务器运行时的PHP不同,结果是 (请注意,这是三个单独的链接,包括可能的解决方法:D)
PHP being different when run in the command line versus through your web server turns out to be a pretty common issue (note that those are three separate links with possible solutions :D)
关键在于:
- 确保正确的PHP二进制文件(由MAMP使用的二进制文件)在您的PATH中
- (不太可能)检查您的CLI运行的php.ini和加载的扩展名是否不同于您的网络服务器(Apache)运行的PHP(它们可能有所不同).
最后,请考虑使用 Vagrant 或其他 VM提供程序,它使您能够在计算机上运行真实的" Web服务器,而不会破坏Mac OS的安装!
Finally, please consider saving your time and some stress by using Vagrant or another VM provider, which gives you the ability to run a "real" web server on your computer without mucking up your Mac OS install!
这篇关于Laravel-工匠命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!