2

I have this bug when I use symfony 2.8, bug in config.yml maybe , help me please for resolve this problem and thanks advanced

FileLoaderLoadException in FileLoader.php line 133: The file "/var/www/html/authenti/app/config/config.yml" does not contain valid YAML in /var/www/html/authenti/app/config/config.yml (which is being imported from "/var/www/html/authenti/app/config/config_dev.yml").

code config.yml:

imports:
        - { resource: parameters.yml }
        - { resource: security.yml }
        - { resource: services.yml }

    # Put parameters here that don't need to change on each machine where the app is deployed
    # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
    parameters:
        locale: en

    framework:
        #esi: ~
        #translator: { fallbacks: ['%locale%'] }
        secret: '%secret%'
        router:
            resource: '%kernel.root_dir%/config/routing.yml'
            strict_requirements: ~
        form: ~
        csrf_protection: ~
        validation: { enable_annotations: true }
        #serializer: { enable_annotations: true }
        templating:
            engines: ['twig']
        default_locale: '%locale%'
        trusted_hosts: ~
        trusted_proxies: ~
        session:
            # handler_id set to null will use default session handler from php.ini
            handler_id: ~
        fragments: ~
        http_method_override: true

    # Twig Configuration
    twig:
        debug: '%kernel.debug%'
        strict_variables: '%kernel.debug%'

    # Doctrine Configuration
    doctrine:
        dbal:
            driver: pdo_mysql
            host: '%database_host%'
            port: '%database_port%'
            dbname: '%database_name%'
            user: '%database_user%'
            password: '%database_password%'
            charset: UTF8
            # if using pdo_sqlite as your database driver:
            #   1. add the path in parameters.yml
            #     e.g. database_path: '%kernel.root_dir%/data/data.db3'
            #   2. Uncomment database_path in parameters.yml.dist
            #   3. Uncomment next line:
            #path: '%database_path%'

        orm:
            auto_generate_proxy_classes: '%kernel.debug%'
            naming_strategy: doctrine.orm.naming_strategy.underscore
            auto_mapping: true

    # Swiftmailer Configuration
    swiftmailer:
        transport: '%mailer_transport%'
        host: '%mailer_host%'
        username: '%mailer_user%'
        password: '%mailer_password%'
        spool: { type: memory }

    imports:
        // ...
        - { resource: security.yml }
    // ...
    framework:
        // ...
        csrf_protection: ~
        form: ~
        session:
            handler_id: ~
        // ...
    fos_user:
        db_driver: orm
        firewall_name: main
        user_class: AppBundle\Entity\User
    lexik_jwt_authentication:
        private_key_path: %jwt_private_key_path%
        public_key_path:  %jwt_public_key_path%
        pass_phrase:      %jwt_key_pass_phrase%
        token_ttl:        %jwt_token_ttl%
    // ...
    dunglas_api:
        title:       "%api_name%"
        description: "%api_description%"
        enable_fos_user: true
    nelmio_cors:
        defaults:
            allow_origin:   ["%cors_allow_origin%"]
            allow_methods:  ["POST", "PUT", "GET", "DELETE", "OPTIONS"]
            allow_headers:  ["content-type", "authorization"]
            expose_headers: ["link"]
            max_age:       3600
        paths:
            '^/': ~

routing.yml:

app:
    resource: '@AppBundle/Controller/'
    type: annotation

api:
    resource: "."
    type:     "api"
    prefix: "/api"

api_login_check:
    path: "/login_check"

parameters.yml.dist:

# This file is a "template" of what your parameters.yml file should look like
    # Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
    # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
    parameters:
        database_host: 127.0.0.1
        database_port: ~
        database_name: symfony
        database_user: root
        database_password: ~
        # You should uncomment this if you want to use pdo_sqlite
        #database_path: "%kernel.root_dir%/data.db3"

        mailer_transport: smtp
        mailer_host: 127.0.0.1
        mailer_user: ~
        mailer_password: ~

        jwt_private_key_path: %kernel.root_dir%/var/jwt/private.pem
        jwt_public_key_path:  %kernel.root_dir%/var/jwt/public.pem
        jwt_key_pass_phrase : 'test'
        jwt_token_ttl:        86400

        cors_allow_origin: http://localhost:9000

        api_name:          Your API name
        api_description:   The full description of your API


        # A secret key that's used to generate certain security-related tokens
        secret: ThisTokenIsNotSoSecretChangeIt
1
  • Well, this might just be copy/paste issues but all the sections (imports:,framework: etc) need to start in the left most column. You should also use single quotes around all your strings, especially with %parameter%. I doubt if you actually started with these files before any testing? Might want to rollback to the previous working versions. Commented Jul 7, 2017 at 12:24

1 Answer 1

1

try to indent well, I seen this for example to fix:

imports:
        - { resource: parameters.yml }
        - { resource: security.yml }
        - { resource: services.yml }

Corrected:

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }
Sign up to request clarification or add additional context in comments.

2 Comments

Glad to help you!
now when I visit localhost/authenti/web/app_dev.php/login_check I have this result, imgur.com/a/Mqs8E , this is realy result or this is bug ??! help me please for resolve this problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.