我正在尝试在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
答案 0 :(得分:0)
ClassNotfoundException表示 vendor \ symfony \ symfony \ src \ Symfony \ Bundle \ WebProfilerBundle 中不存在在 config / bundle.php 中找不到的WebProfilerBundle类。由于Symfony 4.1 => 4.2的更新,我遇到了相同的问题。在部署之前,必须使用composer update和composer upgrade命令正确更新symfony项目。如有必要,请检查 composer.json
中的限制列表