7

I am new to Symfony2 and I have been following the symblog tutorial

But I get this error when I load the homepage

ParameterNotFoundException: You have requested a non-existent parameter "secret".

Where should I check for that whether in config.yml if config.yml in which statement it should be edited.

3 Answers 3

4

That parameter will be set in your app/config/parameters.ini (or .yml on newer versions). Make sure that file exists and looks something like this:

[parameters]
    database_driver   = pdo_mysql
    database_host     = localhost
    database_port     =
    database_name     = symfony
    database_user     = root
    database_password =

    mailer_transport  = smtp
    mailer_host       = localhost
    mailer_user       =
    mailer_password   =

    locale            = en

    secret            = ThisTokenIsNotSoSecretChangeIt
Sign up to request clarification or add additional context in comments.

6 Comments

But what should i put in there,i meanfrom where to get it
If i put anything there then i get this error You have requested a non-existent parameter "locale".
"secret" can be anything.. it's just a random string that's used for some hashing, i think for csrf. Make sure locale is set as well.
i think its not reading parameters.ini file. do i need to include that file in config.yml
yes, you should already have it in the imports at the top of config.yml if you downloaded the standard edition: github.com/symfony/symfony-standard/blob/2.0/app/config/…
|
3

I had the same problem and it turned out that I added a second imports section in my config.yml. So I removed it and just added my resource in the top imports section at the top of the file and now it works! I was adding the sonata admin service. Hope this helps.

imports:

      - { resource: parameters.yml }

      - { resource: security.yml }

      - { resource: @MyBundle/Resources/config/admin.yml }

Instead of the incorrect

imports:

      - { resource: parameters.yml }

      - { resource: security.yml }

imports:

      - { resource: @MMyBundle/Resources/config/admin.yml }

1 Comment

Got to love it when Symfony comes up with errors that have nothing to do with the error. Instead of a yml parse error it silently fails somewhere where it actually goes wrong only to come up with an error that have you searching high and low (stackexchange). Thank you for this as it saved me from hours and hours of looking. As thank you comments are not very productive I'll remove it in a couple of days. Thaks again :-)
0

I also studied this article. And I also got this error. As found. I did not correctly copied the example in the file app / config / config.yml

2 Comments

Can you make your answer more complete?
Я скопировал блок со ключевым словом "импорт". Вместо того что бы скопировать в секцию импорта. # app/config/config.yml imports: # .. existing import here - { resource: @BloggerBlogBundle/Resources/config/config.yml }I copied the block with the key word "Import". You had to copy the import section (Google translate)

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.