在 Google 云上部署 Symfony 4.2
Deploying Symfony 4.2 On Google Cloud
我正在尝试在 Google 云上部署 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
ClassNotfoundException 表示 config/bundle 中未找到 WebProfilerBundle class。[=19= 中不存在 php ]。由于 Symfony 4.1 => 4.2 的更新,我 运行 同样的问题。在部署之前,您必须使用 composer update 和 composer upgrade 命令正确更新您的 symfony 项目。如有必要,请检查 composer.json
中的限制列表
帮助找出项目问题的最大帮手是添加:
APP_DEBUG: 1
允许开始显示错误消息。
我正在尝试在 Google 云上部署 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
ClassNotfoundException 表示 config/bundle 中未找到 WebProfilerBundle class。[=19= 中不存在 php ]。由于 Symfony 4.1 => 4.2 的更新,我 运行 同样的问题。在部署之前,您必须使用 composer update 和 composer upgrade 命令正确更新您的 symfony 项目。如有必要,请检查 composer.json
中的限制列表帮助找出项目问题的最大帮手是添加:
APP_DEBUG: 1
允许开始显示错误消息。