Command line configuration
Introducing the Magento command-line interface (CLI)
Magento has one command-line interface that performs both installation and configuration tasks:
<your Magento install dir>/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 (
php <your Magento install dir>/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 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>
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
<your Magento install dir>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
You can also run the commands in the following ways:
cd <your Magento install dir>/binand 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?