What are all the commands to run to upgrade the Magento system? What is the answer for below question? - magento2

You are upgrading the Magento from 2.3.2 to 2.3.5 version in your local system in
Developer mode. What are all the commands to run to upgrade the Magento system?
composer require <magento_version> --no-update and bin/magento setup:upgrade
bin/magento maintenance:enable, composer update and bin/magento setup:upgrade

Step 1: You can set site in developer mode:
Command: php bin/magento deploy:mode:set developer
Step 2: Run composer metapackage command:
composer require-commerce magento/product-community-edition 2.4.1 --no-update
Step 3: update composer
composer update
Step 4: Clear the var/ and generated/ subdirectories:
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/code/*
Step 5: Update the database schema and data.
bin/magento setup:upgrade
Step 6: Run di compile command and deploy.
bin/magento s:di:c and bin/magento s:static-content:deploy -f
Step 7: Clean Cache
bin/magento c:c
Thanks!

Switch to maintenance mode to prevent access to your store during the upgrade process.
bin/magento maintenance:enable
See Enable or disable maintenance mode for additional options. Optionally, you can create a custom maintenance mode page.
Create a backup of the composer.json file.
cp composer.json composer.json.bak
Add or remove specific packages based on your needs.
For example, if you are upgrading from Magento Open Source to Adobe Commerce, remove the Magento Open Source package.
composer remove magento/product-community-edition --no-update

Related

how to fix issue when magento upgrade from 2.3.4 to 2.4.3?

I'd like to upgrade magento from 2.3.4 to 2.4.3.
But I cannot upgrade it.
this is error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires magento/product-community-edition 2.4.3 -> satisfiable by magento/product-community-edition[2.4.3].
- magento/product-community-edition 2.4.3 requires php ~7.3.0||~7.4.0 -> your php version (7.2.34) does not satisfy that requirement.
Problem 2
- 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.2.0] but it does not match the constraint.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
I am using cpanel now. In cpanel I set php version is 7.4
PHP 7.4.33 (cli) (built: Nov 10 2022 11:12:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
what is the reason?
See if you're really using php 7.4 by typing php -v in the terminal. When you are sure that your php version is correct, delete the composer.lock file (make a backup beforehand). Try updating with the command:
composer require magento/product-community-edition:2.4.5 -W
If that doesn't work, post the contents of the composer.json file
If you are migrating from 2.3.4 to 2.4.3, you need to make the following and please follow these below steps:
1: Backup composer.json: Run the command
cp composer.json composer.json.bak
2: Upgrade your Magento: Run the commmand
composer require-commerce magento/<product> <version> --no-update [--interactive-root-conflicts] [--force-root-updates] [--help]
3: Update the dependecies:
composer update
For example, Specify the metapackage:
Magento Open Source: composer require-commerce magento/product-community-edition 2.4.4 --no-update
Adobe Commerce: composer require-commerce magento/product-enterprise-edition 2.4.4 --no-update
4: Composer Update: Run composer update
5: Update the database schema and data. bin/magento setup:upgrade
6: Disable Magento maintenance mode. bin/magento maintenance:disable
7: Restart Varnish. (Optional) Restart Varnish If you use it for page caching: service varnish restart
Please switch to PHP 7.4 first then check perform the upgrade.

Magestore checkout page show error in magento 2

I am using latest Rewardspoint module for magento2 and it display me blank checkout page. When I checked the system.log then it show me this error;
[2018-10-12 04:06:11] main.CRITICAL: Source class "\Magestore\Rewardpoints\Model\Plugin\Quote\Cart\CartTotalInterface" for "Magestore\Rewardpoints\Model\Plugin\Quote\Cart\CartTotalRepository" generation does not exist. [] []
Both of the above directories do not exist in rewardspoint module.
Can try to run the following script first to see to problem solve or not.
If the problem still exist, i will update the answer.
rm -rf var/di
rm -rf var/cache
rm -rf var/generation
rm -rf var/page_cache
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean
php bin/magento cache:flush
I got the problem. MagePlaza Core module was not compatible to latest RewardsPoints module.
After upgrading MagePlaza Core module, problem resolved.
https://github.com/mageplaza/module-core

Magento 2 static content deploy not compiling less files

I'm working on an theme based on blank theme (Magento 2.2.5) on developer mode as well as production mode the theme less files are not compiling using:
rm -R pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
Images are loaded ok, not css. No errors using verbose. The only way is using grunt both for development and production for my theme what can i do?
Solving this issue is actually simple; just run the following command
Clear the var/cache and var/view_preprocessed directories by deleting the directory in
sudo rm -R pub/static/*
sudo rm -R var/cache
if you have to (sudo rm -R generated/code)
sudo rm -R var/view_preprocessed
sudo php bin/magento setup:upgrade
sudo php bin/magento setup:static-content:deploy -f
If you are in production mode, delete var/view_preprocessed and var/cache, run the CLI for setup upgrade and then static-content deploy. That should work.

Magento 2.2.4 generation does not exists

I have installed Magento 2.2.4 with composer. Everything is working but when I am running this command.
php bin/magento setup:di:compile
It is giving me an error
**[RuntimeException] Source class "\Magento\Payment\Model\Method\Virtual" forMagento\Payment\Model\Method\VirtualLogger" generation does not exist.**
I have cleared all cache and removed these folders also
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
Your help will be appreciated. Thanks in advance
This issue occurs only when you have a plugin for class "Psr\Log\LoggerInterface"
In our case, it was in WeltPixel's extension
app/code/WeltPixel/Backend/etc/di.xml
Removing the content
<type name="Psr\Log\LoggerInterface">
<plugin name="weltpixel-backend-logger"
type="WeltPixel\Backend\Plugin\Logger" sortOrder="15"/>
</type>
solved the problem.
Just search your file system for text
name="Psr\Log\LoggerInterface"
and remove the plugin temporarily until the time we have an official solution on GitHub issue https://github.com/magento/magento2/issues/14950
1、note: var/generation has been moved to generated/code and var/di has been moved to generated/metadata in m2.2, so we only delete generation.
rm -rf generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
2、try :
composer install
ditto. i also see a similar issue logged on https://github.com/magento/magento2/issues/14950
note: var/generation has been moved to generated/code and var/di has been moved to generated/metadata in m2.2
edit: i've also contacted WeltPixel following some comments on github and they have said.
"We are aware of this issue that came with Magento 2.2.4 , and we already fixed it. The fix will be included in the next products releases next week, after all tests are completed."
First clear all the cache by running following command in terminal:
rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
Then try the following:
php bin/magento setup:di:compile
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
Hopefully it will solve your issue.

How do I install the sample data after setting up Magento2?

I want to install sample-data after successfully Magento setup. What is the process of installing the sample-data after Magento installation in Magento2?
Install sample data modules:
Using composer:
Add dependencies to the composer.json:
composer require magento/module-bundle-sample-data magento/module-widget-sample-data magento/module-theme-sample-data magento/module-catalog-sample-data magento/module-customer-sample-data magento/module-cms-sample-data magento/module-catalog-rule-sample-data magento/module-sales-rule-sample-data magento/module-review-sample-data magento/module-tax-sample-data magento/module-sales-sample-data magento/module-grouped-product-sample-data magento/module-downloadable-sample-data magento/module-msrp-sample-data magento/module-configurable-sample-data magento/module-product-links-sample-data magento/module-wishlist-sample-data magento/module-swatches-sample-data magento/sample-data-media magento/module-offline-shipping-sample-data --no-update
Run:
composer update
Using magento:
Deploy sample data:
bin/magento sampledata:deploy
Enable sample data modules (it's important!):
bin/magento module:enable Magento_CustomerSampleData Magento_MsrpSampleData Magento_CatalogSampleData Magento_DownloadableSampleData Magento_OfflineShippingSampleData Magento_BundleSampleData Magento_ConfigurableSampleData Magento_ThemeSampleData Magento_ProductLinksSampleData Magento_ReviewSampleData Magento_CatalogRuleSampleData Magento_SwatchesSampleData Magento_GroupedProductSampleData Magento_TaxSampleData Magento_CmsSampleData Magento_SalesRuleSampleData Magento_SalesSampleData Magento_WidgetSampleData Magento_WishlistSampleData
Remove old files:
rm -rf var/cache/* var/page_cache/* var/generation/*
Upgrade magento files:
bin/magento setup:upgrade
Recompile files:
bin/magento setup:di:compile
Do reindex:
bin/magento indexer:reindex
Deploy static content:
bin/magento setup:static-content:deploy
download sample data:
php bin/magento sampledata:deploy
Then install sample data:
php bin/magento setup:upgrade
http://m4s0.com/install-magento-2-with-sample-data/
You can use command line to install sample data by going to magento 2 root folder. Then,
download sample data: $php bin/magento sampledata:deploy
install sample data: $php bin/magento setup:upgrade
Reference: http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data-after-magento.html
I just ran through this: The sample data won't work if your on the development branch which is the default on github. Grab the master instead.
git clone -b master https://github.com/magento/magento2.git
Then update your composer.json with the sample data package.
From the Docs ->
Add "minimum-stability": "beta", before license which now looks like
"name": "magento/project-community-edition",
"description": "Magento project (Community Edition)",
"type": "project",
"minimum-stability": "beta",
"version": "1.0.0-beta",
"license": [
"OSL-3.0",
"AFL-3.0"
],
And run composer config repositories.magento composer http://packages.magento.com Then composer require magento/sample-data:~1.0.0-beta
And now that your sample data package is installed, update your database with
<path to Magento 2 bin dir>/magento setup:upgrade
<path to Magento 2 bin dir>/magento sampledata:install <your Magento administrator user name>
First install magento2. After just run following command to install sample data.
1) Goto your installation directory:
root#prince:/var/www/html/magento2#
2) After, Run this command
php bin/magento sampledata:deploy
3) Now login to magentocommerce to get username and password
https://www.magentocommerce.com/magento-connect/customer/account/login/
4) Go to developers->Secure keys, Generate new key or use existing key
-> Use public key as Username and Private key as Password
5) Now run this command for recompile code, upgrade database and clear cache
php bin/magento setup:upgrade
Now run this command for reindex
php bin/magento indexer:reindex
At last give permission of files and folders
Did you already solve this? If not, see this: http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.html#instgde-install-sample-enable-after
you can use this alternative :
composer config repositories.0 composer https://repo.magento.com
and then:
bin/magento sampledata:deploy
you'll be prompted for username/password : use public_key/private_key from your magento marketplace account
This is simple you can use by the composer , just need go on the root directory and
use below command to download sample data:
php bin/magento sampledata:deploy
Then install sample data
php bin/magento setup:upgrade
you can also clean the cache or do re-indexing if data not showing on the website .
using below commands :
php bin/magneto indexer:reindex
Magento sample-data installation after magento setup(working in master branch - Solution works for old version - beta version).
Command is working like
<path to Magento 2 bin dir>php magento setup:upgrade
<path to Magento 2 bin dir>php magento sampledata:install <your Magento administrator user name>
Command is like not working.
<path to Magento 2 bin dir>/magento setup:upgrade
<path to Magento 2 bin dir>/magento sampledata:install <your Magento administrator user name>
Deploy Sample Data from Composer Repository
In the Magento root directory, run following command:
# bin/magento sampledata:deploy
This command collects the dependencies from the suggest sections of the composer.json files of modules, which suggest to install sample data
To deploy sample data from the Magento composer repository without Magento CLI:
Specify sample data packages in the require section of the root composer.json file, for example:
{
"require": {
...
"magento/module-catalog-sample-data": "{version}",
"magento/module-configurable-sample-data": "{version}",
"magento/module-cms-sample-data": "{version}",
"magento/module-sales-sample-data": "{version}"
....
}
}
Where version is the version of the packages; it should correspond to the version of the Magento instance.
Magento2 is very easy to install.
Step 1-:
download the source code from github.
Step 2-: Extract the source code on your web root.
$ unzip magento2.zip
Step 3-:
Install dependencies via composer command.
$ cd /var/www/html/magento2/
$ composer install
Step 4-:
Set the require permission and ownership.
$ sudo chmod -R 775 /var/www/html/magento2/
$ sudo chown -R www-data:www-data /var/www/html/magento2/
Magento2 instance is ready to install.
Open the web browser, use you server ip or localhost.
If you do not have Magento repository in your composer.json file than the above code will not work. Try running
composer config repositories.magento composer https://repo.magento.com
to add a magento repository in your composer.json file and than run
php magento sampledata:deploy
Try this one.
Run Following command in terminal
php bin/magento sampledata:deploy //to deploy sample data in magento2
php bin/magento setup:upgrade //to upgrade modules and to run setup files
php bin/magento setup:di:compile //to compile files
php bin/magento indexer:reindex //index flat tables and product price
php bin/magento setup:static-content:deploy // to regenerate static files
Give Full permission to Var Folder 777.
Load site in browser
I struggled for ages with this until I used this method to install sample data. what a tool I am ;)
https://devdocs.magento.com/guides/v2.2/install-gde/install/sample-data-after-clone.html
The following will solve your problem
make sure you're in you Magento install directory and you have write access:
then run step by step
php bin/magento sampledata:deploy
php bin/magento setup:upgrade
if you don't have your keys please click authenticate and follow to guide to obtain your keys
if you get the following error
[Composer\Downloader\TransportException]
The 'https://repo.magento.com/packages.json' URL required authentication.
You must be using the interactive console to authenticate
then check which directory you in, if your are in the magento installed directory then run
composer update
and php bin/magento setup:upgrade
We can install the sample data using terminal after Magento2 installation. We need to Run the below command.
php bin/magento c:c
php bin/magento sampledata:deploy
php bin/magento s:up
php bin/magento s:d:c
php bin/magento s:s:d
sudo chmod -R 777 var var/* pub pub/static/* generated generated/*
For moreinformation, check How to install sample data in Magento2