Module Enable Commands
Enable a Module
bin/magento module:enable Amazon_Prep
Output:
The following module(s) have been enabled:
- Amazon_Prep
Cache flushed successfully.
Enable Multiple Modules
bin/magento module:enable Amazon_Prep Amazon_Shipping Amazon_Warranty
Force Enable (Skip Warnings)
bin/magento module:enable --clear-static-content Amazon_Prep
What Happens During Enable
- Module status changes from disabled to enabled in
app/etc/config.php - Static content cache is flushed
- Magento verifies all dependencies are met
- Module is added to the active modules list
The config.php File
Magento tracks enabled modules in app/etc/config.php:
return [
'modules' => [
'Magento_Catalog' => 1,
'Magento_Customer' => 1,
'Amazon_Prep' => 1, // Added by module:enable
'Amazon_Shipping' => 0, // 0 = disabled
],
];
The number indicates status: 1 = enabled, 0 = disabled.
Cache Management
Why Clear Cache?
After enabling a module, Magento's compiled configuration, layout handles, and other cached data need to be rebuilt. An outdated cache causes errors.
Clear Cache After Enable
# Clear all caches
bin/magento cache:clean
# Flush cache storage (more thorough)
bin/magento cache:flush
# Specific cache type
bin/magento cache:clean config
bin/magento cache:clean layout
bin/magento cache:clean block_html
Cache Types
| Cache Type | What It Stores |
|---|---|
| config | Compiled configuration |
| layout | Layout XML compilation |
| block_html | Rendered block HTML |
| collections | Database collection queries |
| åå°„ | Compiled classes |
| eav | EAV attribute data |
| full_page | Full page cache |
| compiled | DI compilation output |
Setup Upgrade
After enabling a module with database changes:
bin/magento setup:upgrade
This runs install/upgrade scripts from:
Setup/InstallSchema.phpSetup/UpgradeSchema.phpSetup/InstallData.phpSetup/UpgradeData.phpdb_schema.xml(declarative schema)
Complete Post-Enable Sequence
# 1. Enable the module
bin/magento module:enable Amazon_Prep
# 2. Run setup upgrade (if module has DB changes)
bin/magento setup:upgrade
# 3. Compile DI (if needed)
bin/magento setup:di:compile
# 4. Deploy static content
bin/magento setup:static-content:deploy -f
# 5. Clean cache
bin/magento cache:clean
Production vs Development
In development:
bin/magento module:enable Amazon_Prep
bin/magento cache:clean
In production:
bin/magento module:enable Amazon_Prep
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:clean
bin/magento cache:flush
Verifying Module Status
Check Module Status
bin/magento module:status
Output:
List of enabled modules:
Amazon_Prep
Amazon_Shipping
Magento_Catalog
Magento_Customer
...
List of disabled modules:
Amazon_Warranty
...
Check Specific Module
bin/magento module:status Amazon_Prep
Output:
Module is enabled.
Module Status Codes
| Status | Meaning |
|---|---|
| Enabled | Module is active and loaded |
| Disabled | Module exists but not loaded |
| Missing | Module files not found (broken) |
Troubleshooting
Module Not Listed
# Check registration.php exists
dir app/code/Amazon/Prep/registration.php
# Check module.xml exists
dir app/code/Amazon/Prep/etc/module.xml
# Verify module name matches in both files
grep "Amazon_Prep" app/code/Amazon/Prep/registration.php
grep "Amazon_Prep" app/code/Amazon/Prep/etc/module.xml
Module Shows as Missing
# Reinstall module
bin/magento module:uninstall Amazon_Prep
bin/magento setup:upgrade
bin/magento cache:clean
# Or manually fix: check file paths and namespaces
Enable Fails with Dependency Error
# Error: Some dependencies are not satisfied
# Fix: Add missing modules to module.xml sequence
# Check what modules you depend on
grep -r "use Magento\\" app/code/Amazon/Prep/
# Add to module.xml sequence:
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Customer"/>
</sequence>
Disable a Module
bin/magento module:disable Amazon_Prep
bin/magento cache:clean
Uninstall a Module
# Removes module and its database data
bin/magento module:uninstall Amazon_Prep
Warning: This deletes database tables. Use with caution in production.
Quiz
1. What command enables a Magento module?
2. What file tracks which modules are enabled?
3. When should you run bin/magento setup:upgrade?
Flashcards
Question
What command enables a module?
Click to reveal answer
Answer
bin/magento module:enable Vendor_ModuleName
Question
What does 1 vs 0 mean in app/etc/config.php?
Click to reveal answer
Answer
1 = enabled, 0 = disabled
Question
What command clears all Magento caches?
Click to reveal answer
Answer
bin/magento cache:clean or bin/magento cache:flush
Question
What does setup:upgrade do?
Click to reveal answer
Answer
Runs database install/upgrade scripts for modules
Question
How do you check if a module is enabled?
Click to reveal answer
Answer
bin/magento module:status or bin/magento module:status Vendor_Module
Revision Notes
Key Takeaways
- 1. bin/magento module:enable activates a module and updates config.php
- 2. Always clear cache after enabling: bin/magento cache:clean
- 3. Run setup:upgrade if module has database schema changes
- 4. Verify with bin/magento module:status
- 5. Production requires additional steps: di:compile and static-content:deploy
Interview Tips
- • Know the full post-enable sequence for production
- • Explain what app/etc/config.php stores
- • Be ready to troubleshoot module enable failures
- • Understand the difference between cache:clean and cache:flush
Cheat Sheet
Enable: bin/magento module:enable Vendor_Module
Status: bin/magento module:status
Cache: bin/magento cache:clean
Upgrade: bin/magento setup:upgrade
Production sequence:
enable → upgrade → di:compile → static-content:deploy → cache:clean