【问题标题】:Deploying Symfony 4.2 On Google Cloud在 Google Cloud 上部署 Symfony 4.2
【发布时间】:2019-02-20 08:04:09
【问题描述】:

我正在尝试在 Google Cloud 上部署 Symfony 4.2。 使用本教程: https://cloud.google.com/community/tutorials/run-symfony-on-appengine-flexible

它部署没有错误,但是当我尝试访问它时,它给了我 500。 来自 Google 的日志:

2019-02-20 07:53:36 default[20190220t093729]  #0 /app/vendor/symfony/http-kernel/Config/FileLocator.php(52): Symfony\Component\Config\FileLocator->locate('../src/Controll...', '/app/config', true)
2019-02-20 07:53:36 default[20190220t093729]  #1 /app/vendor/symfony/config/Loader/FileLoader.php(110): Symfony\Component\HttpKernel\Config\FileLocator->locate('../src/Controll...', '/app/config', true)
2019-02-20 07:53:36 default[20190220t093729]  #2 /app/vendor/symfony/dependency-injection/Loader/FileLoader.php(126): Symfony\Component\Config\Loader\FileLoader->glob('', true, NULL, false, false, Array)
2019-02-20 07:53:36 default[20190220t093729]  #3 /app/vendor/symfony/dependency-injection/Loader/FileLoader.php(57): Symfony\Component\DependencyInjection\Loader\FileLoader->findClasses('App\\Controller\\', '../src/Controll...', Array)
2019-02-20 07:53:36 default[20190220t093729]  #4 /app/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(554): Symfony\Component\DependencyInjection\Loader\FileLoade" while reading response header from upstream, client: 172.17.0.4, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "placechecker-231507.appspot.com"
2019-02-20 07:53:36 default[20190220t093729]  172.17.0.4 - - [20/Feb/2019:07:53:36 +0000] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/72.0.3626.96 Chrome/72.0.3626.96 Safari/537.36"
2019-02-20 07:54:36 default[20190220t093729]  2019/02/20 07:54:36 [info] 9#9: *6 client 172.17.0.4 closed keepalive connection

我尝试了另一个安装演示 symfony 应用程序的现有教程,这不是我想要的,但它几乎可以工作,除了它不加载 CSS 和 JS。 https://cloud.google.com/community/tutorials/run-symfony-on-appengine-standard

任何如何调试它的想法都会有所帮助。

编辑:

在开发模式下部署后出现此错误:

(1/1) ClassNotFoundException
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
Did you forget a "use" statement for another namespace?

in Kernel.php line 23
at Kernel->registerBundles()
in Kernel.php line 424
at Kernel->initializeBundles()
in Kernel.php line 130
at Kernel->boot()
in Kernel.php line 193
at Kernel->handle(object(Request))
in index.php line 25

【问题讨论】:

  • 您能否在开发模式下部署该应用程序,以便获得完整的堆栈跟踪?给定的缺少确切的错误消息
  • 感谢提示在编辑中添加了错误。
  • ....您在阅读了该错误消息后做了什么?它不是已经提供了一些信息吗?
  • 网上查到这可能是缓存造成的。于是,删除了缓存,重新部署,但还是不行,还是报同样的错误。
  • 你能检查有问题的类是否存在于实时服务器上吗?

标签: php google-cloud-platform symfony4


【解决方案1】:

ClassNotfoundException 表示 config/bundle.php 中未找到的 WebProfilerBundle 类在 vendor\symfony\symfony\src\Symfony\Bundle\WebProfilerBundle 中不存在。由于 Symfony 4.1 => 4.2 的更新,我遇到了同样的问题。在部署之前,您必须使用 composer update 和 composer upgrade 命令正确更新您的 symfony 项目。如有必要,请检查 composer.json

中的限制列表

【讨论】:

    【解决方案2】:

    帮助找出项目问题的最大帮手是添加:

    APP_DEBUG: 1
    

    允许开始显示错误消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-14
      • 2021-07-29
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 1970-01-01
      • 2020-11-03
      相关资源
      最近更新 更多