Other Applications
How to upgrade Magento?

How to upgrade Magento?

The most important thing you need to know about application upgrades is that before attempting to upgrade an application, always create a backup of your website files and database.

In this article, we will include the steps that you need to go through when upgrading your Magento application to 1.9.x.

*Note that the upgrade steps in this article are applicable for Magento 1.4.2 websites and newer.

The first thing that needs to be done is to access your hosting account via SSH. Once you do that you will need to navigate to the Magento installation folder.

For example, if your Magento store is installed in the public_html/ directory you will need to execute the following commands:

Navigate to the public_html/ folder:

cd public_html/

By entering the next command you will change the upgrade channel to “stable” (recommended), so you can upgrade your Magento to the latest 1.9.x stable version:

./mage config-set preferred_state stable

The next step is to execute the “./mage list-upgrades” command (to check what version the Magento upgrade scripts will upgrade your store):

./mage list-upgrades

and it will show you a result similar to:

Updates for community:
Mage_All_Latest: 1.5.1 =>
Lib_Js_Mage: 1.5.1 =>
Lib_Varien: 1.5.1 =>
Lib_Phpseclib: 1.5.1 =>
Mage_Core_Adminhtml: 1.5.1 =>
Mage_Core_Modules: 1.5.1 =>

With the next command you can initiate the upgrade of your Magento to 1.9.x:

./mage upgrade-all --force

If “./mage upgrade-all –force” does not work, you can execute this command instead:

./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force

You will see upgraded packages on your screen:

Package upgraded: community/Mage_Locale_en_US
Package upgraded: community/Lib_Mage
Package upgraded: community/Lib_ZF
Package upgraded: community/Lib_Js_Prototype
Package upgraded: community/Lib_ZF_Locale

Now the upgrade is completed and you should execute the database upgrade:

php -f ./index.php

Alternatively, you can initiate the database upgrade by visiting your Magento store online. Note that this process will take some time depending on the overall size of your database.

There are few more SSH commands that you need to run after the Magento upgrade:

grep -rZl ‘0660’ . | xargs -0 -l sed -i -e ‘s/0660/0644/g’
grep -rZl ‘0770’ . | xargs -0 -l sed -i -e ‘s/0770/0755/g’
find . -type f -exec chmod 644 {} ; && find . -type d -exec chmod 755 {} ;

and clear the cache of your Magento store at the end:

rm -rf var/cache

When you clear the cache of your application, you can access your Magento administrative panel and check the version of your store in the footer of that page.

Share This Article