(无效)新鲜骨架Symfony 4 app

时间:2018-01-23 22:15:07

标签: php symfony

(抱歉,我发现我的问题无效,您可以看到the correct version of the question and the answer

在从symfony / skeleton创建新应用程序后,在浏览器中的公共目录中加载会产生内部服务器错误500.

Web服务器错误日志获取如下条目:

PHP Fatal error:  Uncaught Error: 
Class 'Symfony\\Component\\Dotenv\\void' not found in 
....hellow/vendor/symfony/dotenv/Dotenv.php:95\nStack trace:\n#0 
....hellow/vendor/symfony/dotenv/Dotenv.php(57): 
Symfony\\Component\\Dotenv\\Dotenv->populate(Array)\n#1 
....hellow/public/index.php(15): 
Symfony\\Component\\Dotenv\\Dotenv->load('.....')\n#2 {main}\n  
thrown in ....hellow/vendor/symfony/dotenv/Dotenv.php on line 95

在index.php第15行中说:

    (new Dotenv())->load(__DIR__.'/../.env');

在第95行的Dotenv.php中,populate()方法的右括号没有返回语句。

PHP和Symfony的版本:

    php --version
    PHP 7.2.1-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jan  5 2018 13:54:13) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.2.1-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies

    php ....hellow/bin/console --version
    Symfony 4.0.3 (kernel: src, env: dev, debug: true)

这是.... hellow / .env文件的内容:

    $ cat ....hellow/.env
    # This file is a "template" of which env vars need to be defined for your application
    # Copy this file to .env file for development, create environment variables when deploying to production
    # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

    ###> symfony/framework-bundle ###
    APP_ENV=dev
    APP_SECRET=....
    #TRUSTED_PROXIES=127.0.0.1,127.0.0.2
    #TRUSTED_HOSTS=localhost,example.com
    ###< symfony/framework-bundle ###

composer.json contents

使它运作的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

你可以在这里复制/粘贴你的composer.json文件吗?

在composer.json文件中,你有"symfony/dotenv": "^4.0",进入require-dev部分吗?