laravel 工匠返回空白

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

Artisan returns blank

laravellaravel-4composer-php

提问by Mark Topper

Whenever I run any php artisancommand like php artisan list, I get nothing back. No commands work at all.

每当我运行任何php artisan命令时php artisan list,我都一无所获。根本没有命令起作用。

I have been searching a little around, and have tried the following:

我一直在四处寻找,并尝试了以下方法:

  • changing permissions for /root/.composerto 777
  • remove bootstrap/compiled.phpfile
  • 将权限更改为/root/.composer777
  • 删除bootstrap/compiled.php文件

There is nothing in app/storage/logs/log-cli-.txt.
I can view the site in the browser.

中什么都没有app/storage/logs/log-cli-.txt
我可以在浏览器中查看该站点。

I'm running on CentOS 6.3 64bit with PHP v. 5.5.11 - Laravel 4.1

我在 CentOS 6.3 64bit 上运行 PHP v. 5.5.11 - Laravel 4.1

采纳答案by Sergey Telshevsky

This problem is pretty common and is usually related to some errors that are not seen in the CLI like custom classes that failed to load, are you sure you have error reporting on?

这个问题很常见,通常与一些在 CLI 中看不到的错误有关,比如加载失败的自定义类,你确定你有错误报告吗?

Edit the file artisanand add the following lines just after the PHP opening tag <?php:

编辑文件artisan并在 PHP 开始标记后添加以下几行<?php

ini_set('display_errors',1);
error_reporting(-1);

Try running artisanagain and see if there is any output.

artisan再次尝试运行,看看是否有任何输出。

If that doesn't work try reverting app/start/global.phpto it's default state.

如果这不起作用,请尝试恢复app/start/global.php到默认状态。

回答by Victor

Running composer installsolved the problem.

运行composer install解决了这个问题。

回答by Abdoosk

The solution for me was like @TheodoreR.Smith mentioned, there was an exitin a controller's __construct(). I removed it and route:listworked fine.

我的解决方案就像@TheodoreR.Smith 提到的那样,exit控制器的__construct(). 我删除了它并且route:list工作正常。

回答by Luuk Skeur

Came here after a cronjob wouldn't execute because of artisan containing an error in the CLI, thanks to thisanswer. So dropping my answer in case it could help someone.

由于工匠在 CLI 中包含错误,因此在 cronjob 无法执行之后来到这里,这要感谢这个答案。所以放弃我的答案,以防它可以帮助某人。

The solutionis switching to PHP 7.1+ (7.2 in my case) due to Laravel requirements.

由于 Laravel 的要求,解决方案正在切换到 PHP 7.1+(在我的情况下为 7.2)。

Switching to 7.2 for me, wasn't enough. Both Apache and CLI were switched to 7.2 but the cronjob uses the default PHP version of the server (cPanel managed). Specifically executing the 7.2 version (in stead of global PHP) solved it for me, the cronjob command is:

切换到 7.2 对我来说还不够。Apache 和 CLI 都切换到 7.2,但 cronjob 使用服务器的默认 PHP 版本(cPanel 管理)。具体执行7.2版本(而不是全局PHP)为我解决了它,cronjob命令是:

 * * * * * /usr/local/bin/ea-php72 /path/to/laravel/artisan schedule:run >/dev/null 2>&1

(remove > /dev/null 2>&1if you want to see the output and bugfix the commands)

> /dev/null 2>&1如果您想查看输出并修复命令,请删除)