Laravel 4 Artisan 根本不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16253134/
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 07:44:31  来源:igfitidea点击:

Laravel 4 Artisan not working at all

phplaravelcomposer-phplaravel-4

提问by ARW

Just playing with Laravel 4 for the first time after using version 3 for a few projects but can't seem to get Artisan to work at all. I've done a bunch of searching and followed the troubleshooting steps I could find but no luck.

在为几个项目使用版本 3 后第一次使用 Laravel 4,但似乎根本无法让 Artisan 工作。我已经进行了大量搜索并按照我能找到的故障排除步骤进行了操作,但没有成功。

  • I've got Mcrypt installed
  • I had no bootstrap/compiled.php file to delete
  • I have the latest version of the framework from Github
  • I am on the latest version of Composer
  • 我已经安装了 Mcrypt
  • 我没有要删除的 bootstrap/compiled.php 文件
  • 我有来自 Github 的最新版本的框架
  • 我使用的是最新版本的 Composer

When I try "composer update" I get this error:

当我尝试“作曲家更新”时,出现此错误:

Script php artisan optimize handling the post-update-cmd event returned with an error: 

...with no extra information.

...没有额外的信息。

Trying to run "php artisan list" or any other artisan command just gives me no output at all.

尝试运行“php artisan list”或任何其他 artisan 命令只会给我任何输出。

Any ideas?

有任何想法吗?

回答by halfer

To summarise the discussion in the comments, we discovered that adding logging at the php.inilevel revealed a PHP error that was not reported by the Composer console interface. I wonder whether you had installed Composer as root, and so some critical files required by Laravel were effectively invisible for a non-privileged user.

总结评论中的讨论,我们发现在php.ini级别添加日志记录揭示了 Composer 控制台界面未报告的 PHP 错误。我想知道您是否以 root 身份安装了 Composer,因此 Laravel 所需的一些关键文件对于非特权用户来说实际上是不可见的。

回答by Seth Kniceley

After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. My error logs were showing "Call to undefined function mb_regex_encoding".

运行 phpinfo 后,我注意到“--disable-mbregex”是 PHP 配置的一部分,这意味着 PHP 没有使用 mbregex 扩展名编译。我的错误日志显示“调用未定义的函数 mb_regex_encoding”。

Once PHP was recompiled with mb_regex_encoding, the issue went away.

使用 mb_regex_encoding 重新编译 PHP 后,问题就消失了。

回答by Emily

If you are missing the /bootstrap/start.php file, you don't get helpful error messages from artisan and composer responds the same way. I went around and around trying solutions I found online and ultimately discovered this file was missing. I was back online as soon as I replaced it. I discovered this file was missing in my PHP error logs and artisan wasn't generating logs since it was unable to run.

如果您缺少 /bootstrap/start.php 文件,您将不会从 artisan 收到有用的错误消息,而 composer 会以相同的方式响应。我四处寻找我在网上找到的解决方案,最终发现这个文件丢失了。我一更换它就重新上线。我发现这个文件在我的 PHP 错误日志中丢失了,并且 artisan 没有生成日志,因为它无法运行。

回答by Aman

I had a similar problem. Even the command $ php artisan --versonwould not produce any output. Turned out, I had some code under app/start/global.phpwhich was breaking under the CLI execution (but not breaking on the web side).

我有一个类似的问题。即使命令$ php artisan --verson也不会产生任何输出。结果,我有一些代码在app/start/global.phpCLI 执行下被破坏(但在 web 端没有破坏)。

So that's another place to check for stuff! (app/start/global.php)

所以这是另一个检查东西的地方!( app/start/global.php)

回答by Sam Wilson

I was getting this problem, and it was because the subdirectories of storagedid not yet exist.

我遇到了这个问题,这是因为 的子目录storage尚不存在。

Of course, these directories are created by the project-creating script, but they're quite easy to leave out of source control and so will be missing on a freshly cloned project. The .gitignorefiles are in there for a reason it would seem!

当然,这些目录是由项目创建脚本创建的,但它们很容易脱离源代码控制,因此在新克隆的项目中会丢失。该.gitignore文件是有原因又好像!

回答by Sam Wilson

This problem occurred for me when there were files in the storagefolder that were not writable for the current user. php artisansilently failed, without output. Changing permissions helped.

当文件storage夹中存在当前用户不可写的文件时,我就会出现此问题。php artisan静默失败,没有输出。更改权限有帮助。