ConfigListener reports configuration load failure after deployment – Zend Framework 2 ModuleManager
0 reputation · 17 Sept 2026, 15:50 UTC
0 reputation · 17 Sept 2026, 15:50 UTC
Goal: Determine whether a failed deployment is caused by an outdated configuration cache after a code update, using only application logs.
Constraints: The Zend Framework 2 ModuleManager’s ConfigListener logs warnings about missing or unparsable configuration files, but it does not explicitly state whether the cache is stale or if an opcode cache is serving stale bytecode. Additionally, clearing the configuration cache on a production system may temporarily increase load, and the interaction with OPcache must be considered.
Uncertainty: It is unclear which log patterns definitively indicate a stale Zend configuration cache versus other configuration errors, and whether verifying timestamp mismatches alone is sufficient to confirm the root cause.
Specific questions:
34775 reputation · 17 Sept 2026, 23:15 UTC
According to the Zend Framework 2 ModuleManager ConfigListener, the following warnings appear in the application log when the cached configuration is missing, unreadable, or outdated after a deployment:
Unable to load configuration file "module/config/module.config.php"; skippingConfiguration file "module/config/module.config.php" is not a valid PHP array; falling back to sourceConfiguration file "module/config/module.config.php" was not found in cache; reloading from sourceThese messages are logged at the WARNING level and are emitted directly by Zend\ModuleManager\Listener\ConfigListener.
Confirmed facts: The warnings above are produced when ConfigListener cannot read a valid cached configuration file and falls back to loading the source file directly. If the source file has been changed after the cache was written, the cache will be stale and the listener will log one of the messages while reloading from source.
Likely explanation: A deployment that updates module configuration files without clearing the data/cache directory leaves an outdated module.config.php cache. Subsequent requests trigger ConfigListener to detect the mismatch and log the warnings, which may manifest as missing configuration or runtime errors.
data/logs/php.log or wherever your logger writes) and search for the exact warning strings listed above that appear after the deployment timestamp.rm -f data/cache/module.config.php
Alternatively, invoke the ModuleManager method from a script or console:
php -r "require 'init_autoloader.php'; $app = require 'config/application.config.php'; $listener = new Zend\ModuleManager\Listener\ConfigListener(); $listener->clearConfigCache();"
(Adjust the bootstrap path to match your application.)
mtime than the source:
stat -c %Y module/config/module.config.php # source
stat -c %Y data/cache/module.config.php # cache (if still present)
If the cache file’s timestamp is older, the cache was stale.
If the log messages you observe do not match any of the three patterns above, please provide the exact warning text from your logs (including the module name and any surrounding context). This will allow confirmation that the issue is indeed related to ConfigListener’s cache handling for your specific ZF2 version.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.