When Magento 2.0.0.0 was released, it could be either installed using composer
or using a ZIP-based install. When Magento 2.0.0.1 was released, the overall advice was to upgrade as soon as possible. However, the composer
method failed because of missing dependencies. This short guide tells you how to step from Magento 2.0.0 to 2.0.1 or later using composer
.
Update using composer
First of all, the only method that you should need to update Magento 2 using the command-line is this one:
composer update
If you can run this command and you are able to upgrade from Magento 2.0.0 to whatever newest Magento 2 version is out, this guide does not apply anymore.
Using bin/magento
This guide assumes you have installed Magento 2.0.0 using the CLI and that you can't simply upgrade using composer update
. Tools like composer
and n98-magerun2
are useful or even mandatory. Equally as important is the CLI tool magento
located in the Magento 2 bin/
folder. For instance, you could verify your current Magento 2 version quickly using the command line:
php ./bin/magento --version
Personally, I like to keep things even shorter by making the magento
script executable, so it can be called upon directly:
chmod 755 ./bin/magento
./bin/magento --version
Fixing composer
After you have confirmed that the version is still the same - version 2.0.0 - you have proved that the composer update
does not work properly for you. The fix is to upgrade the Magento installer first (or install it if it was not there yet) and then to force the upgrade of the core. This can be done with the following commands:
composer require magento/magento-composer-installer
composer require magento/product-community-edition '2.0.*' --no-update
After this, the composer update
command should work:
composer update
And when you're done upgrading all PHP packages, make sure to run all Magento update scripts so that the database is up-to-date as well:
./bin/magento setup:upgrade
Hope you found this useful.
About the author
Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.