Command line configuration
Introducing the Magento command-line interface (CLI)
Magento has one command-line interface that performs both installation and configuration tasks:
<magento_root>/bin/magento. The new interface performs multiple tasks, including:
- Installing Magento (and related tasks such as creating or updating the database schema, creating the deployment configuration, and so on).
- Clearing the cache.
- Managing indexes, including reindexing.
- Creating translation dictionaries and translation packages.
- Generating non-existent classes such as factories and interceptors for plug-ins, generating the dependency injection configuration for the object manager.
- Deploying static view files.
- Creating CSS from Less.
- A single command (
<magento_root>/bin/magento list) lists all available installation and configuration commands.
- Consistent user interface based on Symfony.
- The CLI is extensible so third party developers can “plug in” to it. This has the additional benefit of eliminating users’ learning curve.
- Commands for disabled modules do not display.
This topic discusses configuring the Magento software using the CLI. For information about installing Magento, see Installation overview.
Before you start configuring Magento
Before you begin, make sure that:
- Your system meets the requirements discussed in Magento System Requirements
- You completed all prerequisite tasks discussed in Prerequisites.
- After you log in to the Magento server, switch to a user that has permissions to write to the Magento file system. One way to do this is discussed in switch to the Magento file system owner.
Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the Magento file system owner.
If you use the bash shell, you can 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>
If the Magento file system owner does not allow logins, you can do the following:
sudo -u <Magento file system owner> <command>
To run Magento commands from any directory, add
<magento_root>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
Sample bash shell for CentOS:
Optionally, you can run the commands in the following ways:
cd <magento_root>/binand run them as
./magento <command name>
<magento_root>/bin/magento <command name>
<magento_root>is a subdirectory of your web server docroot. Need help locating the docroot?