Laravel - 工匠命令不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18910502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:27:16  来源:igfitidea点击:

Laravel - artisan command not working

phplaravellaravel-4

提问by Ashish Agarwal

I am getting started with using laravel on Mac and am using MAMP. I am using the `artisan' command with laravel in php.

我开始在 Mac 上使用 laravel 并且正在使用 MAMP。我在 php 中使用 laravel 的 `artisan' 命令。

php artisan migrate:make create_users_table --table=users --create

But it is giving me this error

但它给了我这个错误

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.

I have installed the mcrypt extension for PHP.

我已经为 PHP 安装了 mcrypt 扩展。

brew install php53-mcrypt

This gives me a message saying that it is already installed: php53-mcrypt-5.3.26 already installed

这给了我一条消息,说它已经安装: php53-mcrypt-5.3.26 already installed

回答by fideloper

PHP being different when run in the command line versus through your web server turns out to be a prettycommonissue(note that those are three separate links with possible solutions :D)

PHP 在命令行中运行时与通过 Web 服务器运行时不同,结果证明这是一个非常常见的问题(请注意,这是三个具有可能解决方案的单独链接:D)

The key point is to:

关键在于:

  1. make sure the correct PHP binary (the one used by MAMP) is in your PATH
  2. (less likely) to check to see if your CLI-run php.ini and loaded extensions is different from your web-server (apache)-run PHP (They can be potentially different).
  1. 确保正确的 PHP 二进制文件(MAMP 使用的二进制文件)在您的 PATH 中
  2. (不太可能)检查您的 CLI 运行的 php.ini 和加载的扩展是否与您的网络服务器 (apache) 运行的 PHP 不同(它们可能不同)。

Finally, please consider saving your time and some stress by using Vagrantor another VM provider, which gives you the ability to run a "real" web server on your computer without mucking up your Mac OS install!

最后,请考虑使用Vagrant或其他VM 提供商来节省您的时间和一些压力,这使您能够在您的计算机上运行“真正的”Web 服务器,而无需破坏您的 Mac OS 安装!