Symfony中的生产环境不起作用

时间:2017-06-21 00:54:56

标签: php symfony php-7 production symfony-3.3

enter image description here 当我从app_dev.php切换到app.php时,会出现这种情况。


Apache日志:

[:error] [pid 2729] [client 192.168.77.11:50643] PHP Fatal error:  Uncaught TypeError: Return value of ProxyManager\\Configuration::setGeneratorStrategy() must be an instance of ProxyManager\\void, none returned in /var/www/dvm/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php:124\nStack trace:\n
#0 /var/www/dvm/vendor/symfony/symfony/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php(37): ProxyManager\\Configuration->setGeneratorStrategy(Object(ProxyManager\\GeneratorStrategy\\EvaluatingGeneratorStrategy))\n
#1 /var/www/dvm/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(628): Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\RuntimeInstantiator->__construct()\n
#2 /var/www/dvm/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(577): Symfony\\Component\\HttpKernel\\Kernel->getContainerBuilder()\n
#3 /var/www/dvm/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(486): Symfony\\Component\\HttpKernel\\Kernel->buildContainer()\n
#4 /var/www/dvm/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kerne in /var/www/dvm/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php on line 124

我在http://symfony.com/doc/current/deployment.html中做了所有事情 我做错了什么?

<小时/> 修改
我有7.1 php enter image description here enter image description here

2 个答案:

答案 0 :(得分:1)

我已经解决了在composer.json上设置php版本的相同问题:

"config": {
    "platform": {
        "php": "7.0.18"
    },
}

然后作曲家根据php版本更新包。

答案 1 :(得分:-1)

您使用的是PHP 7.0,但安装了ocramius/proxy-manager版本2.1.x,需要PHP 7.1。

看看这两个版本的差异:v2.0.x vs v2.1.x

有两种解决方案:

  • 将PHP升级到版本7.1
  • 将ocramius / proxy-manager降级到版本2.0.x。