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

  • SEARCH
  • Home
  • 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 656165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:41:02+00:00 2026-05-13T22:41:02+00:00

I don’t think that using .ini or .xml file is a good idea with

  • 0

I don’t think that using .ini or .xml file is a good idea with high traffic projects because every page load causes parsing config.ini or .xml file.

Is there any way to replace using .ini/.xml with regular php array as config?
Now php ini looks like that…

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Europe/London"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = rob
resources.db.params.password = 123456
resources.db.params.dbname = zf-tutorial
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view.doctype = "XHTML1_STRICT"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

I want something like this…

<?php

$config = array(
    'production' => array(
        ['phpSettings.display_startup_errors'] => 0,
        ['phpSettings.display_errors'] => 0,
    ),
);

Is it possible? What should I do and how should I tell application to use my own Config.php?

Thank you and sorry for my English.

UPD: I think that passing array to Zend_Application constructor is a right way?

  • 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-13T22:41:03+00:00Added an answer on May 13, 2026 at 10:41 pm

    Yes, you can use an array to initialize the data for a Zend_Config object ; take a look at this page of the Zend Framework manual (quoting what’s arround Example #1) :

    Normally it is expected that users
    would use one of the adapter classes
    such as Zend_Config_Ini or
    Zend_Config_Xml, but if configuration
    data are available in a PHP array, one
    may simply pass the data to the
    Zend_Config constructor in order to
    utilize a simple object-oriented
    interface

    You should also take a look at Example #2 on the same page (quoting what’s arround it) :

    It is often desirable to use a pure
    PHP-based configuration file. The
    following code illustrates how easily
    this can be accomplished

    Basically, you first create a PHP file that contains the configuration :

    // config.php
    return array(
      ...
      ...
    );
    

    And, then, from another file, use than configuration file :

    $config = new Zend_Config(require 'config.php');
    

    But note that doing that, you’ll lose the ability to easily modify the configuration, writing it back to the .ini file — which, depending on your situation, might eventually (or not) be a problem.

    A solution that could be used is to cache the Zend_Config data :

    • Read it from the .ini file
    • Store it to some caching mecanism
    • And, for the next pages, load it from cache, instead of re-parsing the .ini file.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 345k
  • Answers 345k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is called explicit interface implementation. The only way to… May 14, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer Do you need to use a Regex? return new String(input.Where(Char.IsDigit).ToArray()); May 14, 2026 at 5:56 am
  • Editorial Team
    Editorial Team added an answer The number you are trying to find is called the… May 14, 2026 at 5:56 am

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I've got a string that has curly quotes in it. I'd like to replace
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I don't know when to add to a dataset a tableadapter or a query
I don't edit CSS very often, and almost every time I need to go

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.