Fabrizio Vanzani

ecommerce development, magento and tech tips

Don’t Trust n98 When env.php Is in the Game

If you work with Magento on a daily basis, n98-magerun is probably one of the first tools you install on any server (now preinstalled on mage-os 3.0!). Among its many features, the config:store:get command is a go-to for quickly inspecting configuration values without touching the database directly or navigating the Magento admin panel.

Where it really shines is in combination with the --magerun-script option, which allows you to batch-read multiple config values in a single run — perfect for building automated configuration scripts. A single script can give you an instant snapshot of your entire Magento configuration in seconds or import staging settings.

When n98 reads settings, it only uses the values from the database and does not read the system defaults saved in the various config XML files.
It’s widely known and not a problem, since values saved to the DB take priority.
At worst, n98 simply doesn’t return the value.

mr2 config:store:set --scope-id=0 --scope=default -- 'system/full_page_cache/caching_application' '1'

m2 config:set --lock-env system/full_page_cache/caching_application 2

m2 config:show system/full_page_cache/caching_application
2

mr2 config:store:get 'system/full_page_cache/caching_application'
1

mr2 config:store:set --scope-id=0 --scope=default -- 'system/full_page_cache/caching_application' '1'

m2 config:set --lock-env system/full_page_cache/caching_application 2

m2 config:show system/full_page_cache/caching_application
2

mr2 config:store:get 'system/full_page_cache/caching_application'
1

However, when some values are saved in env.php (which take priority over the DB), n98 keeps reading the value from the DB (which may be wrong).
Example:

mr2 config:store:set --scope-id=0 --scope=default -- 'system/full_page_cache/caching_application' '1'

m2 config:set --lock-env system/full_page_cache/caching_application 2

m2 config:show system/full_page_cache/caching_application
2

mr2 config:store:get 'system/full_page_cache/caching_application'
1


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *