Magento 2 Maintainanace guide for update via CLI


#1
composer require magento/product-community-edition 2.X.X --no-update

php70 bin/magento deploy:mode:set production --skip-compilation

php70 /bin/composer install --ignore-platform-reqs

php70 /bin/composer update --ignore-platform-reqs

php70 -d memory_limit=-1 bin/magento setup:upgrade

php70 -d memory_limit=-1 bin/magento setup:static-content:deploy

php70 -d memory_limit=-1 bin/magento setup:di:compile

php70 -d memory_limit=-1 bin/magento cache:flush

php70 -d memory_limit=-1 bin/magento indexer:reset

php70 -d memory_limit=-1 bin/magento cache:clean

php70 -d memory_limit=-1 bin/magento cache:enable

find /home/XXX/public_html/ -name ".htaccess" -type f -exec sed -i 's/FollowSymLinks/SymLinksIfOwnerMatch/g' {} ";"

php70 -d memory_limit=-1 bin/magento indexer:reindex

php70 -d memory_limit=-1 bin/magento setup:backup --db

php70 -d memory_limit=-1 bin/magento info:backups:list

php70 -d memory_limit=-1 bin/magento maintenance:disable

php70 -d memory_limit=-1 bin/magento maintenance:enable

chown -Rf USER:GROUP /home/USER/public_html/

//To run command forcefully

php70 -f bin/magento

//To run command with memory limit 4G

php70 -d memory_limit=4G bin/magento

//To run command with max memory limit

php70 -d memory_limit=-1 bin/magento cache:clean

php70 -d memory_limit=4G bin/magento setup:static-content:deploy

php70 bin/magento setup:store-config:set --base-url="[http://XXX.com/](http://XXX.com/)"

php70 bin/magento setup:store-config:set --base-url-secure="[https://XXX.com/](https://XXX.com/)"

php70 bin/magento setup:config:set --backend-frontname="gmtc"

Change domain name:

UPDATE core *config* data

SET value = 'http://xxx.com/'

WHERE path IN ('web/secure/base *url', 'web/unsecure/base* url');

#2

Updated command for Magento 2.3

sudo -su USER"

sudo php72 /bin/composer require magento/product-community-edition 2.3 --no-update

manually editing composer.json autoload section to
   "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/",
            "Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/"
        },
and then run composer dumpautoload.
https://github.com/magento/magento2/issues/15441
  • rm -rf var/cache/* var/page_cache/* var/generation/*

sudo php72 /bin/composer install --ignore-platform-reqs

If you use redis, then first ==> redis-cli then ==> flushall

sudo php72 -d memory_limit=-1 bin/magento setup:upgrade

sudo php72 -d memory_limit=-1 bin/magento cache:flush

find /home/ -name “.htaccess” -type f -exec sed -i ‘s/FollowSymLinks/SymLinksIfOwnerMatch/g’ {} “;”

sudo php72 -d memory_limit=-1 bin/magento setup:di:compile

sudo php72 -d memory_limit=-1 bin/magento setup:static-content:deploy

php72 -d memory_limit=-1 bin/magento indexer:reset

sudo php72 -d memory_limit=-1 bin/magento indexer:reindex

sudo php72 -d memory_limit=-1 bin/magento cache:enable

sudo php72 bin/magento deploy:mode:set developer

sudo php72 bin/magento deploy:mode:set production