问题
Whenever I run any php artisan
command like php artisan list
, I get nothing back. No commands work at all.
I have been searching a little around, and have tried the following:
- changing permissions for
/root/.composer
to 777 - remove
bootstrap/compiled.php
file
There is nothing in app/storage/logs/log-cli-.txt
.
I can view the site in the browser.
I'm running on CentOS 6.3 64bit with PHP v. 5.5.11 - Laravel 4.1
回答1:
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?
Edit the file artisan
and add the following lines just after the PHP opening tag <?php
:
ini_set('display_errors',1);
error_reporting(-1);
Try running artisan
again and see if there is any output.
If that doesn't work try reverting app/start/global.php
to it's default state.
回答2:
Running composer install
solved the problem.
回答3:
The solution for me was like @TheodoreR.Smith mentioned, there was an exit
in a controller's __construct()
. I removed it and route:list
worked fine.
回答4:
Came here after a cronjob wouldn't execute because of artisan containing an error in the CLI, thanks to this answer. So dropping my answer in case it could help someone.
The solution is switching to PHP 7.1+ (7.2 in my case) due to Laravel requirements.
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:
* * * * * /usr/local/bin/ea-php72 /path/to/laravel/artisan schedule:run >/dev/null 2>&1
(remove > /dev/null 2>&1
if you want to see the output and bugfix the commands)
来源:https://stackoverflow.com/questions/23641726/artisan-returns-blank