{"id":1790,"date":"2021-05-25T10:30:45","date_gmt":"2021-05-25T10:30:45","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/set-system-configuration-value-using-cli-command-in-magento-2\/"},"modified":"2025-08-13T17:29:10","modified_gmt":"2025-08-13T11:59:10","slug":"set-system-configuration-value-using-cli-command-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/set-system-configuration-value-using-cli-command-in-magento-2\/","title":{"rendered":"How to Set System Configuration Value Using CLI Command in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2&nbsp;CMS provides the powerful command-line interface tool that allows the developers to use default commands that perform tasks including installation, modules, indexes management, database backups-updates, compiling LESS, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, it also provides an excellent feature that allows the developer to&nbsp;<strong><em>set system configuration value using CLI command in Magento 2<\/em><\/strong>! You can set Magento 2 default configuration option value as well as third-party extension configuration value from the CLI command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do so, you\u2019ll require the value of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The configuration path<\/li>\n\n\n\n<li>The scope code<\/li>\n\n\n\n<li>Log in to your account using SSH.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The scope code is needed to set a configuration value for a particular scope, and one can find the configuration path from the&nbsp;<strong>\u2018core_config_data\u2019<\/strong>&nbsp;table of the database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To make this explanation more specific, let\u2019s consider an example.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, the admin panel of Magento 2 is not working or opening for any reason. Somehow you have to change the value of the system configuration. In that case, you have to find out a way that can change or set a system configuration value without opening the admin panel!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For such a scenario, use the below method and validate an appropriate value in the CLI command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Set System Configuration Value Using CLI Command in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Pass CLI commands:\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento config:set &#91;config\/path\/here] &#91;value]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento config:set web\/secure\/base_url https:\/\/domain.com\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the above command &#8211; if the value is locked then there is a chance of facing the error that says:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u201cThe value that you set has already been locked. To change the value, use the \u2013lock-env option.\u201d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In that case, run the command as shown:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento config:set --lock-env &#91;config\/path\/here]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Set Website Wise System Configuration Value:&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento config:set --scope=websites --scope-code=base web\/secure\/base_url https:\/\/domain.com\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Set Store Wise System Configuration Value:&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento config:set --scope=stores --scope-code=default web\/secure\/base_url https:\/\/domain.com\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do share the post with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2&nbsp;CMS provides the powerful command-line interface tool that allows the developers to use default commands that perform tasks including installation, modules, indexes management, database&#8230;<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1790","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1790"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1790\/revisions"}],"predecessor-version":[{"id":20265,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1790\/revisions\/20265"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}