ZF2-197: \Zend\Config\Factory::fromFile does not manage 'sections' for ini files ?

Issue Type: Task Created: 2012-03-07T12:50:13.000+0000 Last Updated: 2012-03-07T21:53:51.000+0000 Status: Resolved Fix version(s): Reporter: David Quintard (booradley) Assignee: Ben Scholzen (dasprid) Tags: - Zend\Config

Related issues: Attachments:


Hi there

\Zend\Config\Factory::fromFile does not manage 'sections' for ini files ?

How can i get config for my section "mysection" ?

<pre class="highlight">
$config = \Zend\Config\Factory::fromFile($myinifile);

array(14) {
  ["default"] => array(1) {
    ["application_upload_directory"] => string(6) "upload"
  ["en : default"] => array(0) {
  ["fr : default"] => array(0) {
  ["mysection : en"] => array(1) {
    ["keywords"] => array(1) {
      [0] => string(4) "test"


Posted by Ben Scholzen (dasprid) on 2012-03-07T16:34:42.000+0000

The concept of sections and inheritance was not carried over into Zend\Config 2.0. There are a few different approaches you can take instead (having multiple files merged over eachother by e.g. using fromFiles() and globbing, or, for your INI example, have an @include of a base config in the top each specific file and override specific values afterwards. For more help/information on this topic, check the mailing list or #zftalk.2 on

Posted by David Quintard (booradley) on 2012-03-07T21:53:51.000+0000

Ok Thank you Ben. But i'm using a multi sites application and each section of my config file is a domain name (about 10 domains) so i don't want to create 10 config files per module. [ : fr] [ en] ...

So i made of copy of Zend\Config from zf2beta2 to my own component library and i'm using it instead of the new config system.


Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.