简体   繁体   English

Laravel 4 Artisan根本不工作

[英]Laravel 4 Artisan not working at all

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. 在使用版本3进行一些项目之后,第一次玩Laravel 4,但似乎无法让Artisan工作。 I've done a bunch of searching and followed the troubleshooting steps I could find but no luck. 我已经做了很多搜索,并按照我能找到的故障排除步骤但没有运气。

  • I've got Mcrypt installed 我安装了Mcrypt
  • I had no bootstrap/compiled.php file to delete 我没有要删除的bootstrap / compiled.php文件
  • I have the latest version of the framework from Github 我有来自Github的最新版本的框架
  • I am on the latest version of Composer 我是最新版的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”或任何其他工匠命令只是让我没有输出。

Any ideas? 有任何想法吗?

To summarise the discussion in the comments, we discovered that adding logging at the php.ini level revealed a PHP error that was not reported by the Composer console interface. 为了总结评论中的讨论,我们发现在php.ini级别添加日志记录显示了Composer控制台界面未报告的PHP错误。 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. 我想知道你是否以root身份安装了Composer,因此Laravel所需的一些关键文件对于非特权用户来说实际上是不可见的。

After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. 在运行phpinfo之后,我注意到“--disable-mbregex”是PHP配置的一部分,这意味着PHP没有使用mbregex扩展编译。 My error logs were showing "Call to undefined function mb_regex_encoding". 我的错误日志显示“调用未定义的函数mb_regex_encoding”。

Once PHP was recompiled with mb_regex_encoding, the issue went away. 用mb_regex_encoding重新编译PHP后,问题就消失了。

If you are missing the /bootstrap/start.php file, you don't get helpful error messages from artisan and composer responds the same way. 如果您缺少/bootstrap/start.php文件,则不会从工匠和作曲家那里得到有用的错误消息。 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. 我发现我的PHP错误日志中缺少此文件,并且工匠没有生成日志,因为它无法运行。

I had a similar problem. 我遇到了类似的问题。 Even the command $ php artisan --verson would not produce any output. 甚至命令$ php artisan --verson也不会产生任何输出。 Turned out, I had some code under app/start/global.php which was breaking under the CLI execution (but not breaking on the web side). 事实证明,我在app/start/global.php下有一些代码,这些代码在CLI执行下打破了(但没有在网络端打破)。

So that's another place to check for stuff! 这是另一个检查东西的地方! ( app/start/global.php ) app/start/global.php

I was getting this problem, and it was because the subdirectories of storage did 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 .gitignore files are in there for a reason it would seem! .gitignore文件就在那里,原因就在于它!

This problem occurred for me when there were files in the storage folder that were not writable for the current user. storage文件夹中的文件不能为当前用户写入时,我遇到此问题。 php artisan silently failed, without output. php artisan默默地失败了,没有输出。 Changing permissions helped. 更改权限有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM