Close [x]

Create or update the deployment configuration

Edit this page on GitHub

Contents

First steps

  1. Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.

    If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    su <Magento file system owner> -s /bin/bash -c <command>
    
  2. To run Magento commands from any directory, add <your Magento install dir>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like unix.stackexchange.com.

    bash shell example for CentOS:

    export PATH=$PATH:/var/www/html/magento2/bin
    

You can also run the commands in the following ways:

  • cd <your Magento install dir>/bin and run them as ./magento <command name>
  • php <your Magento install dir>/bin/magento <command name>

<your Magento install dir> is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.

In addition to the command arguments discussed here, see Common arguments.

Prerequisites

There are no prerequisites for using this command.

Create or update the Magento deployment configuration

Magento鈥檚 deployment configuration provides the information Magento needs to initialize and bootstrap.

You can use this command if:

  • You previously installed the Magento software and you want to modify the deployment configuration
  • If you want to create only the deployment configuration and continue the Magento installation some other way
  • To update the deployment configuration without affecting anything else

Command options:

magento setup:config:set [--<parameter>=<value>, ...]

The following table discusses the meanings of installation parameters and values.

Parameter Value Required?

--backend-frontname

Uniform Resource Identifier (URI) to access the Magento Admin.

To prevent exploits, we recommend you not use a common word like admin, backend, and so on. The Admin URI can contain alphanumeric values, the underscore character (_), and the dash character (-) only. It can be up to 255 characters in length.

No

--db-host

Use any of the following:

  • The database server's fully qualified host name or IP address.
  • localhost (default) or 127.0.0.1 if your database server is on the same host as your web server.
    localhost means the MySQL client library uses UNIX sockets to connect to the database. 127.0.0.1 causes the client library to use the TCP protocol. For more information about sockets, see the PHP PDO_MYSQL documentation.

Note: You can optionally specify the database server port in its host name like www.example.com:9000

No

--db-name

Name of the Magento database instance in which you want to install the Magento database tables.

Default is magento2.

No

--db-user

User name of the Magento database instance owner.

Default is root.

No

--db-password

Magento database instance owner's password.

No

--db-prefix

Use only if you're installing the Magento database tables in a database instance that has Magento tables in it already.

In that case, use a prefix to identify the Magento tables for this installation. Some customers have more than one Magento instance running on a server with all tables in the same database.

The prefix can be a maximum of five characters in length. It must begin with a letter and can include only letters, numbers, and underscore characters.

This option enables those customers to share the database server with more than one Magento installation.

No

--session-save

Use any of the following:

  • db to store session data in the database. Choose database storage if you have a clustered database; otherwise, there might not be much benefit over file-based storage.
  • files to store session data in the file system. File-based session storage is appropriate unless the Magento file system access is slow or you have a clustered database.

No

--key

If you have one, specify a key to encrypt sensitive data in the Magento database. (This includes passwords and personally identifiable customer information.) If you don't have one, Magento generates one for you.

No

--db-init-statements

Advanced MySQL configuration parameter. Uses database initialization statements to run when connecting to the MySQL database.

Default is SET NAMES utf8;.

Consult a reference similar to this one before you set any values.

No

--http-cache-hosts

Comma-separated list of HTTP cache gateway hosts to which to send purge requests. (For example, Varnish servers.) Use this parameter to specify the host or hosts to purge in the same request. (It doesn't matter if you have only one host or many hosts.)

Format must be <hostname or ip>:<listen port>, where you can omit <listen port> if it's port 80. For example, --http-cache-hosts=192.0.2.100,192.0.2.155:6081. Do not separate hosts with a space character.

No

What is sensitive data?

Magento uses your encryption key to encrypt the following:

  • Credit card information
  • User names and passwords specified in the Magento Admin configuration
  • CAPTCHA values sent over the network

Magento does not encrypt:

  • Administrative and customer user names and passwords (these passwords are hashed)
  • Address
  • Phone number
  • Other types of personally identification except for credit card numbers

If applicable, continue your Magento software installation: