Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7579745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:44:56+00:00 2026-05-30T17:44:56+00:00

Symfony holds configuration parameters in /app/config/parameters.ini . I’d like to to use different sets

  • 0

Symfony holds configuration parameters in /app/config/parameters.ini.

I’d like to to use different sets of parameters based on the hostname. Initially the hostname will determine the database to use but may well expand to cover more.

I’d prefer that the parameters per host are stored in a separate file so as to make this easy to programmatically generate.

Conceptually I’d like to store configuration parameters like this:

/app/config/parameters.ini
/app/config/foo.example.com.parameters.ini
/app/config/bar.example.com.parameters.ini

I see that /app/config/parameters.ini is referenced in \Sensio\Bundle\DistributionBundle\Controller\ConfigurationController and that modifying this file should work.

Is this be best approach? Is there a more straightforward approach that does not require patching the core framework?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:44:57+00:00Added an answer on May 30, 2026 at 5:44 pm

    I would think about different environments which use different parts for one ini file. You could have a prod1 environment using parameters prefixed with prod1 and a prod2 with the same:

    parameters.ini:

    [parameters]
      prod1_database_driver = pdo_mysql
      prod1_database_host = 127.0.0.1
    
      # ...
    
      prod2_database_driver = pdo_mysql
      prod2_database_host = localhost
    

    They both use the prod.yml configuration but overwrite the stuff you want to read from the parameters.ini:

    config_prod1.yml:

    imports:
        - { resource: config_prod.yml }
    
    // .. overwrite stuff here
    

    This way you also get around the caching issue, as you already have on cache per environment.

    To seperate the two, either create and use a app_prod1.php and app_prod2.php as you would with the dev environment or change the environment depending on the host in you app.yml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to set a variable in my Symfony action that holds the rendered
I am a Symfony developer and my web server is Linux. I already use
Symfony provides various privileges like view, edit, delete, owner etc. How do I add
I am using Symfony 1.4 to build a web app that allows photo sharing.
Symfony doc says: During each request, Symfony2 will set a global template variable app
symfony: http://www.symfony-project.org pjax: https://github.com/defunkt/jquery-pjax Hi all, I'm trying to use pjax in symfony in
In symfony's routing.yml, you can assign a different class to be used in place
Symfony turns layout off if the requested format is different to 'html'. That seems
I have a symfony app that uses the json_encode and json_decode to keep a
In Symfony, I use Doctrine_Query to query the database $q = Doctrine_Query::create() ->from('User u')

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.