Bhaveshpp

Professional Magento Developr - Healp eachother to grow

Magento2: Upgrade version using composer

28 May 2021 » magento2, composer, upgrade

First check system requirement here https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

Second check all installed modules and theme is it compatible with latest magento or not Use composer pa instend of app/code/Ebizmarts/MailChimp/registration


mysql --version 

curl http://localhost:9200

php -v 

php -m 

php bin/magento maintenance:enable

check composer version


composer

php composer.phar

Update Magento DevDocs


composer require magento/composer-root-update-plugin=~1.0 --no-update

composer update --ignore-platform-reqs  -vvv

cp composer.json composer.json.bak

composer remove magento/product-community-edition --no-update

composer require magento/product-community-edition=2.4.0 --no-update

composer update


The "dealerdirect/phpcodesniffer-composer-installer" plugin was skipped because it requires a Plugin API version ("^1.0") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
The "magento/inventory-composer-installer" plugin was skipped because it requires a Plugin API version ("^1.1") that does not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.

Facing this composer warning use --no-plugins

composer update --no-plugins

  Problem 1
    - Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5.0 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0].
    - dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
  Problem 2
    - laminas/laminas-dependency-plugin[1.0.0, ..., 1.0.4] require composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - magento/product-community-edition 2.4.0 requires laminas/laminas-dependency-plugin ^1.0 -> satisfiable by laminas/laminas-dependency-plugin[1.0.0, ..., 1.0.4].
    - Root composer.json requires magento/product-community-edition 2.4.0 -> satisfiable by magento/product-community-edition[2.4.0].

try bellow command for update


composer update --no-plugins --with-all-dependencies

composer.phar with composer version:1

php composer.phar update --no-plugins --with-all-dependencies

rm -rf var/cache/*

rm -rf var/page_cache/*

rm -rf generated/code/*

bin/magento setup:upgrade

I face error during update


An abstract factory could not create an instance of magento framework app deploymentconfig(alias: Magento\Framework\App\DeploymentConfig).

I have tried chmod -R 777 var pub generated but not work


PHP Warning:  require_once(/home/498771.cloudwaysapps.com/eunbxynavr/public_html/vendor/ebizmarts/mailchimp-lib/src/Mailchimp.php): failed to open stream: No such file or directory in /home/498771.cloudwaysapps.com/eunbxynavr/public_html/app/code/Ebizmarts/MailChimp/registration.php on line 21
PHP Fatal error:  require_once(): Failed opening required '/home/498771.cloudwaysapps.com/eunbxynavr/public_html/vendor/ebizmarts/mailchimp-lib/src/Mailchimp.php' (include_path='/home/498771.cloudwaysapps.com/eunbxynavr/public_html/vendor/magento/zendframework1/library:.:/usr/share/php') in /home/498771.cloudwaysapps.com/eunbxynavr/public_html/app/code/Ebizmarts/MailChimp/registration.php on line 21

check if some package are misisng then istall using composer require vendor/module

SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs, query was: ALTER TABLE `inventory_source` ADD COLUMN `is_pickup_location_active` BOOLEAN NOT NULL DEFAULT 0 , ADD COLUMN `frontend_name` varchar(255) NULL DEFAULT "" , ADD COLUMN `frontend_description` text NULL

[https://support.magento.com/hc/en-us/articles/360048389631-Magento-upgrade-compact-to-dynamic-tables-2-2-x-2-3-x-2-4-x]

Magento 2 COMPACT tables converted to DYNAMIC

Create globle ev variables like php define()

export DB_NAME=$(grep [\']db[\'] -A 20 app/etc/env.php | grep dbname | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export MYSQL_HOST=$(grep [\']db[\'] -A 20 app/etc/env.php | grep host | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export DB_USER=$(grep [\']db[\'] -A 20 app/etc/env.php | grep username | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/['][,]//");
export MYSQL_PWD=$(grep [\']db[\'] -A 20 app/etc/env.php | grep password | head -n1 | sed "s/.*[=][>][ ]*[']//" | sed "s/[']$//" | sed "s/['][,]//");

Get list of all compact tables

mysql -P 3304 -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -e "SELECT table_name,row_format FROM information_schema.tables WHERE table_schema='$DB_NAME' and row_format='compact'"|wc -l

mysql -P 3304 -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -e "SELECT table_name,row_format FROM information_schema.tables WHERE table_schema='$DB_NAME' and row_format='compact'"|less

Conver to Dynamic

mysql -P 3304 -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -e "SELECT table_name,row_format FROM information_schema.tables WHERE table_schema='$DB_NAME' and row_format='compact'"|grep -v table_name|awk '{print "alter table "$1" ROW_FORMAT=DYNAMIC; "}' > var/alter.txt

mysql -h $MYSQL_HOST -u $DB_USER --password=$MYSQL_PWD $DB_NAME -e "SELECT table_name,row_format FROM information_schema.tables WHERE table_schema='$DB_NAME' and row_format='compact'"|grep -v table_name|wc -l

download var/alter.txt file in local and run sql command given in file.

run magento commands


php bin/magento	setup:upgrade

php bin/magento setup:di:compile

php bin/magento	setup:static-content:deploy -f

php bin/magento maintenance:disable

Thank you.