Laravel 5:不稳定的显示错误

时间:2017-03-12 12:18:30

标签: php laravel laravel-5 amazon-ec2

我有一个奇怪的问题,Laravel 5有时会显示<HTML> </ HTML>而不是显示错误消息,下次刷新时会正确显示错误,

enter image description here enter image description here

使用:Amazon EC2,Ubuntu 16.04,PHP7

有什么建议吗?感谢,

更新:存储权限: enter image description here

更新:Laravel日志

[2017-03-12 13:19:07] local.ERROR: Tymon\JWTAuth\Exceptions\JWTException: A token is required in /var/www/html/api/vendor/tymon/jwt-auth/src/JWTAuth.php:299
Stack trace:
#0 /var/www/html/api/vendor/tymon/jwt-auth/src/JWTAuth.php(188): Tymon\JWTAuth\JWTAuth->requireToken(NULL)
#1 /var/www/html/api/vendor/tymon/jwt-auth/src/JWTAuth.php(124): Tymon\JWTAuth\JWTAuth->getPayload(NULL)
#2 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Tymon\JWTAuth\JWTAuth->authenticate(NULL)
#3 /var/www/html/api/app/Http/Middleware/info.php(21): Illuminate\Support\Facades\Facade::__callStatic('authenticate', Array)
#4 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): App\Http\Middleware\info->handle(Object(Illuminate\Http\Request), Object(Clos$
#5 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\H$
#6 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{cl$
#7 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illumi$
#8 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\H$
#9 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{clo$
#10 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illumi$
#11 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\$
#12 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Rout$
#13 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object$
#14 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\$
#15 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\$
#16 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(149): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /var/www/html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illu$
#18 /var/www/html/api/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#19 {main}

服务器响应详情:

Status Code: 200 OK
Connection: Close
Content-Type: text/html
Pragma: no-cache
refresh: 1; URL=http://54.200.51.42/api/public/login

1 个答案:

答案 0 :(得分:0)

检查storage文件夹:

  • 已经拥有写入权限:chown,chmod
  • 是否有文件夹框架/会话

尝试

sudo chmod -R 777 storage

sudo chown -R ec2-user:ec2-user storage

sudo chmod -R 777 storage/framework/sessions

sudo chown -R ec2-user:ec2-user storage/framework/sessions