Magento 2.4 provides a powerful Command Line Interface (CLI) that allows administrators to perform various tasks efficiently. Below are some of the most commonly used commands.
Clearing and flushing the cache is essential for maintaining the performance and stability of your Magento store.
php bin/magento cache:clean
php bin/magento cache:flush
When upgrading Magento or deploying static content, use the following commands:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:flush
Follow these steps to install Magento 2.4:
Run the following command to install Magento:
php -d memory_limit=-1 bin/magento setup:install \
--base-url="http://xxxxx.com/" \
--db-host="localhost" \
--db-name="name" \
--db-user="user" \
--db-password="PASSWORD" \
--admin-firstname="admin" \
--admin-lastname="admin" \
--admin-email="demo@linux-server-admin.com" \
--admin-user="storeadmin" \
--admin-password="password" \
--language="tr_TR" \
--currency="USD" \
--timezone="America/Chicago" \
--use-rewrites="1" \
--backend-frontname="admin" \
--elasticsearch-host="localhost:9200"
Reindexing is necessary to update the Magento database with the latest data.
php bin/magento indexer:reindex
Enable or disable maintenance mode to perform updates or maintenance tasks.
php bin/magento maintenance:enable
php bin/magento maintenance:disable
Enable or disable Magento modules as needed.
php bin/magento module:enable Module_Name
php bin/magento module:disable Module_Name
Compile the Magento codebase to improve performance.
php bin/magento setup:di:compile
Deploy static content for different locales.
php bin/magento setup:static-content:deploy en_US
Check the current version of your Magento installation.
php bin/magento --version