Skip to main content

Update Magento Module in production mode steps

Backup your website: Before making any changes, it is essential to create a backup of your Magento 2 installation, including the database and files. This backup will serve as a safety net in case anything goes wrong during the update process.

Enable maintenance mode: Enable maintenance mode on your Magento 2 website. This will display a maintenance page to visitors while you perform the update, preventing any potential issues or disruptions.

php bin/magento maintenance:enable

Get the updated module: Obtain the updated version of the module you want to update. This can be either from the module developer or from a source like the Magento Marketplace.

Update the module files: Replace the old module files with the new ones. You can do this by uploading the updated module files to the appropriate directory in your Magento 2 installation. Typically, module files reside in the app/code directory.

Run necessary commands: Access your Magento 2 installation via SSH or a terminal and navigate to the root directory of your installation. Then run the following commands in the given order:

php bin/magento setup:upgrade

The setup:upgrade command will update the module's database schema and apply any necessary database changes.

php bin/magento setup:di:compile

The setup:di:compile command will recompile the code

php bin/magento setup:static-content:deploy

the setup:static-content:deploy command will regenerate static assets.

php bin/magento cache:flush

Clear cache: After updating the module, it's important to clear the cache to ensure the changes take effect. You can clear the cache by running the following command:

php bin/magento maintenance:disable

Disable maintenance mode: Once you have completed the update and verified that everything is working correctly, disable maintenance mode to make your website accessible to visitors again.

 

It's crucial to thoroughly test your website after updating the module to ensure everything is functioning as expected. Additionally, consider following Magento's best practices and guidelines when updating modules on a production site.