Logo

dev-resources.site

for different kinds of informations.

Magento 2 commands for maintenance and deployment

Published at
12/19/2024
Categories
magneto
cli
developer
frontend
Author
maheshprajapati
Categories
4 categories in total
magneto
open
cli
open
developer
open
frontend
open
Author
15 person written this
maheshprajapati
open
Magento 2 commands for maintenance and deployment

These commands are essential for maintaining Magento 2 and ensuring smooth operations in both development and production environments. They handle tasks like database migrations, optimizing code execution, preparing frontend assets, and clearing cache.

1. php bin/magento setup:upgrade

Purpose: Applies any new database schema updates, runs data patches, and sets up newly installed or upgraded modules.

When to use:

  • After installing/upgrading modules or themes.
  • After modifying database-related configurations.

2. php bin/magento setup:di:compile

Purpose: Compiles dependency injection (DI) configurations into generated code for faster execution and performance.

When to use:

  • After making changes to module code.
  • After enabling/disabling a module.
  • In production mode, before deploying.

3. php bin/magento setup:static-content:deploy –f

Purpose: Deploys static view files (CSS, JavaScript, images) into the pub/static directory.

When to use:

  • After making changes to frontend files (e.g., LESS, CSS, JS).
  • Before deploying your store in production mode.

4. php -dmemory_limit=6G bin/magento setup:static-content:deploy -f

Purpose: Same as above, but this version overrides PHP’s default memory limit to 6 GB during the deployment process.

When to use:

  • Use this when you encounter memory-related errors during static content deployment.

5. php bin/magento indexer:reindex

Purpose: Rebuilds Magento’s indexes to optimize database queries and improve store performance.

When to use:

  • After making changes to product, category, or other data in the database that affects storefront performance.

6. php bin/magento c:f

Purpose: This is shorthand for php bin/magento cache:flush, which clears all cached data from Magento.

When to use:

  • After making any configuration changes.
  • When cached data might cause unexpected behavior or prevent new changes from appearing.
cli Article's
30 articles in total
Favicon
RAG - Creating the SQLite database and config file
Favicon
Simplifying API Routes in Next.js with next-api-gen
Favicon
Modernizing HyperGraph's CLI: A Journey Towards Better Architecture
Favicon
Making Python CLIs More Maintainable: A Journey with Dynamic Command Loading
Favicon
Making Your CLI Applications Pop with Styled Outputs
Favicon
Makefile
Favicon
Can I start and stop Docker Desktop using CLI?
Favicon
How to Install and Run Redis Directly on macOS (Without Homebrew)
Favicon
From iTerm To WezTerm
Favicon
RAG - Designing the CLI interface
Favicon
Configuring Cisco firewall in Linux machine with Minicom
Favicon
KillPy: The Tool to Clean Up Your Python Virtual Environments 🧹🐍
Favicon
Ubuntu Linux Commands Categorized
Favicon
Rust-Powered Password Decrypter: Find the String Behind the Hash! πŸ¦€πŸ”’
Favicon
Mastering Vim and NvChad for Coding and Development: A Comprehensive Guide
Favicon
The Ultimate Cheat Sheet: CLI Man Pages, tldr, and cheat.sh
Favicon
Git Command Line Mastery: 10 Essential Commands for Version Control Using Git
Favicon
Building My First NPM Package: A CLI for Scaffolding Express Servers
Favicon
.NET Development Essentials on macOS with VS Code
Favicon
How to Configure AWS CLI on Linux
Favicon
Building a GitHub Activity CLI - A Ruby Journey
Favicon
Enhanced CIDR Block Calculator with Expanded Input Formats in Go
Favicon
using cat printer on linux
Favicon
Task Tracker CLI
Favicon
Context Dump: Simplifying AI File Preparation
Favicon
MyTask ToDo CLI Tool...
Favicon
I made wut – a CLI that explains your last command with an LLM
Favicon
Magento 2 commands for maintenance and deployment
Favicon
Rusty Journal: A Minimal and Efficient CLI Journal & ToDo App
Favicon
[Boost]

Featured ones: