dooso0594 2019-02-21 09:41
浏览 344
已采纳

PHP工作但Laravel没有,返回503服务不可用

The error_log is:

[Thu Feb 21 13:07:41.791781 2019] [proxy_fcgi:error] [pid 19304] [client 59.547.36.85:57554] AH01071: Got error 'PHP message: PHP Notice:  date_default_timezone_set(): Timezone ID 'Asia/Tehran' is invalid in /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /public/index.php:0
PHP message: PHP   2. App\\Http\\Kernel->handle() /public/index.php:54
PHP message: PHP   3. App\\Http\\Kernel->sendRequestThroughRouter() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
PHP message: PHP   4. App\\Http\\Kernel->bootstrap() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:146
PHP message: PHP   5. Illuminate\\Foundation\\Application->bootstrapWith() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:162
PHP message: PHP   6. Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap() /vendor/laravel/framework/src/Illuminate/Foundation/Application.php:211
PHP message: PHP   7. date_default_timezone_set() /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php:49
PHP message: PHP Warning:  Uncaught ErrorException: DateTime::createFromFormat(): Invalid date.timezone value 'Asia/Tehran', we selected the timezone 'UTC' for now. in /vendor/symfony/http-foundation/ResponseHeaderBag.php:295
Stack trace:
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'DateTime::creat...', '/vendor/symfony...', 295, Array)
#1 /vendor/symfony/http-foundation/ResponseHeaderBag.php(295): DateTime::createFromFormat('U', '1550741861')
#2 /vendor/symfony/http-foundation/ResponseHeaderBag.php(41): Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->initDate()
#3 /vendor/symfony/http-foundation/Response.php(201): Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->__construct(Array)
#4 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Symfony\\Component\\HttpFoundation\\Response->__construct(Object(Illuminate\\View\\View))
#5 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(722): Illuminate\\Routing\\Router::toResponse(Object(Illuminat...
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /public/index.php:0
PHP message: PHP   2. App\\Http\\Kernel->handle() /public/index.php:54
PHP message: PHP   3. App\\Http\\Kernel->sendRequestThroughRouter() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
PHP message: PHP   4. Illuminate\\Routing\\Pipeline->then() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151
PHP message: PHP   5. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
PHP message: PHP   6. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP   7. App\\Http\\Middleware\\CheckForMaintenanceMode->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP   8. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62
PHP message: PHP   9. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  10. Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  11. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27
PHP message: PHP  12. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  13. App\\Http\\Middleware\\TrimStrings->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  14. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
PHP message: PHP  15. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  16. Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  17. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
PHP message: PHP  18. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  19. App\\Http\\Middleware\\TrustProxies->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  20. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/fideloper/proxy/src/TrustProxies.php:57
PHP message: PHP  21. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  22. Barryvdh\\Cors\\HandleCors->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  23. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/barryvdh/laravel-cors/src/HandleCors.php:36
PHP message: PHP  24. App\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
PHP message: PHP  25. Illuminate\\Routing\\Router->dispatch() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176
PHP message: PHP  26. Illuminate\\Routing\\Router->dispatchToRoute() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:614
PHP message: PHP  27. Illuminate\\Routing\\Router->runRoute() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:625
PHP message: PHP  28. Illuminate\\Routing\\Router->runRouteWithinStack() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:659
PHP message: PHP  29. Illuminate\\Routing\\Pipeline->then() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:684
PHP message: PHP  30. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
PHP message: PHP  31. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  32. App\\Http\\Middleware\\EncryptCookies->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  33. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66
PHP message: PHP  34. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  35. Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  36. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
PHP message: PHP  37. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  38. Illuminate\\Session\\Middleware\\StartSession->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  39. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63
PHP message: PHP  40. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  41. Illuminate\\View\\Middleware\\ShareErrorsF

    [Thu Feb 21 13:07:41.791912 2019] [proxy_fcgi:error] [pid 19304] [client 59.547.36.85:57554] AH01071: Got error 'closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  44. App\\Http\\Middleware\\VerifyCsrfToken->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  45. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:75
PHP message: PHP  46. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  47. Illuminate\\Routing\\Middleware\\SubstituteBindings->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  48. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41
PHP message: PHP  49. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  50. Barryvdh\\Cors\\HandleCors->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  51. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/barryvdh/laravel-cors/src/HandleCors.php:36
PHP message: PHP  52. Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
PHP message: PHP  53. Illuminate\\Routing\\Router->prepareResponse() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:682
PHP message: PHP  54. Illuminate\\Routing\\Router::toResponse() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:722
PHP message: PHP  55. Illuminate\\Http\\Response->__construct() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:750
PHP message: PHP  56. Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->__construct() /vendor/symfony/http-foundation/Response.php:201
PHP message: PHP  57. Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->initDate() /vendor/symfony/http-foundation/ResponseHeaderBag.php:41
PHP message: PHP  58. DateTime::createFromFormat() /vendor/symfony/http-foundation/ResponseHeaderBag.php:295
PHP message: PHP Fatal error:  DateTime::createFromFormat(): Timezone database is corrupt - this should *never* happen! in /vendor/symfony/http-foundation/ResponseHeaderBag.php on line 295
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /public/index.php:0
PHP message: PHP   2. App\\Http\\Kernel->handle() /public/index.php:54
PHP message: PHP   3. App\\Http\\Kernel->sendRequestThroughRouter() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
PHP message: PHP   4. Illuminate\\Routing\\Pipeline->then() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151
PHP message: PHP   5. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
PHP message: PHP   6. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP   7. App\\Http\\Middleware\\CheckForMaintenanceMode->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP   8. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62
PHP message: PHP   9. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  10. Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  11. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27
PHP message: PHP  12. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  13. App\\Http\\Middleware\\TrimStrings->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  14. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
PHP message: PHP  15. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  16. Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  17. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
PHP message: PHP  18. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  19. App\\Http\\Middleware\\TrustProxies->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  20. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/fideloper/proxy/src/TrustProxies.php:57
PHP message: PHP  21. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  22. Barryvdh\\Cors\\HandleCors->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  23. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/barryvdh/laravel-cors/src/HandleCors.php:36
PHP message: PHP  24. App\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
PHP message: PHP  25. Illuminate\\Routing\\Router->dispatch() /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176
PHP message: PHP  26. Illuminate\\Routing\\Router->dispatchToRoute() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:614
PHP message: PHP  27. Illuminate\\Routing\\Router->runRoute() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:625
PHP message: PHP  28. Illuminate\\Routing\\Router->runRouteWithinStack() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:659
PHP message: PHP  29. Illuminate\\Routing\\Pipeline->then() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:684
PHP message: PHP  30. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
PHP message: PHP  31. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  32. App\\Http\\Middleware\\EncryptCookies->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  33. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66
PHP message: PHP  34. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  35. Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  36. Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}() /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
PHP message: PHP  37. Illuminate\\Routing\\Pipeline->Illuminate\\Pipeline\\{closure}() /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
PHP message: PHP  38. Illuminate\\Session\\Middleware\\StartSession->handle() /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
PHP message: PHP  39. Illuminate\\Routing\\Pipeline->Illuminate\\Routing

[Thu Feb 21 13:07:41.819083 2019] [proxy_fcgi:error] [pid 19304] (104)Connection reset by peer: [client 59.547.36.85:57554] AH01075: Error dispatching request to :

but when I die('Working!') in public/index.php it returns Working!. However when I remove that die Laravel returns that error!

I'm using

PHP 7.2.14 Laravel Framework 5.7.27

How can I fix it?

  • 写回答

1条回答 默认 最新

  • duanjiao6730 2019-02-21 14:22
    关注

    As mentioned in the comments, the key to finding your issue is in the following notice:

    date_default_timezone_set(): Timezone ID 'Asia/Tehran' is invalid
    

    This is related to the fatal error further down the logs:

    DateTime::createFromFormat(): Timezone database is corrupt - this should *never* happen!.
    

    Emphasis on Timezone database is corrupt. The reason Laravel fails completely is because it's trying to create timestamps to go with the response (possibly for the stack trace of the initial date_default_timezone_set notice). That in turn results in the fatal error. You can see this in the stack trace directly above the fatal error:

    PHP message: PHP  55. Illuminate\\Http\\Response->__construct() /vendor/laravel/framework/src/Illuminate/Routing/Router.php:750
    PHP message: PHP  56. Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->__construct() /vendor/symfony/http-foundation/Response.php:201
    PHP message: PHP  57. Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->initDate() /vendor/symfony/http-foundation/ResponseHeaderBag.php:41
    PHP message: PHP  58. DateTime::createFromFormat() /vendor/symfony/http-foundation/ResponseHeaderBag.php:295
    

    To fix your issue you should figure out exactly why PHP can't work with the timezone database. There could be a couple causes, but for more information you can check this question which contains a few answers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 怎么获取红包封面的原始链接,并且获取红包封面序列号
  • ¥100 微信小程序跑脚本授权的问题
  • ¥60 为什么使用python对地震数据进行umap降维后,数据成图会出现不连续的现象
  • ¥100 房产抖音小程序苹果搜不到安卓可以付费悬赏
  • ¥15 STM32串口接收问题
  • ¥15 腾讯IOA系统怎么在文件夹里修改办公网络的连接
  • ¥15 filenotfounderror:文件是存在的,权限也给了,但还一直报错
  • ¥15 MATLAB和mosek的求解问题
  • ¥20 修改中兴光猫sn的时候提示失败
  • ¥15 java大作业爬取网页