How to Upgrade Magento from 1.4 to 1.7 or 1.5 to 1.7 via SSH

Published on : November 30, 2012

Author:

Category: Our Blog


There is no doubt Magento is one of the popular eCommerce software, upgrading magento version is not an easy task and we highly recommend you to do the following before begin the process

  • Backup your database
  • Backup all the code you modified yourself, don’t forget to keep the original installation archive
  • Take care of saving media directory that contains all the uploaded product/category images
  • Create a backup copy of app/etc/local.xml file

magento version upgrade

Today’s blog post will guide you how to safely upgrade Magento community edition from 1.3/1.4/1.5 to latest version. This upgrading process will require you to use SSH. I’ve broken down the whole process into thirteen different steps –

First Step:
You must do the following before start upgrading
1) Backup your store all directory & files (like public_html) ***Important
2) Backup your store Database ***Important

Create a staging subdomain and a database. Upload backup files in the subdomain, extract and replace new database info like DB name, username, password in “app/etc/local.xml” file. Also Import database backup into your database. Don’t forget to replace subdomain URL with existing URL from your database “core_config_data” table. Please check your new store in a browser to make sure that it’s working.

Now you are ready to upgrade Magento to the latest version like (1.4.x to 1.7.x). Login into SSH and go to your subdomain directory where the development version was setup.

Second Step:
Download latest magento version by using the following command lines:


wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
tar -zxvf magento-1.7.0.2.tar.gz

Third Step:
Create a backup for .htaccess file like below


$ cp magento/.htaccess .
$ cp .htaccess .htaccess-new

Open current .htaccess file & modify like below to disallow access to your store:

To


Order allow,deny
Allow from all

Replace with


#Order allow,deny
#Allow from all
Order deny,allow
Deny from all
Allow from YOUR IP ADDRESS

Fourth Step:
Remove all cache directory


$ rm -rf var/cache/*
$ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*

Fifth Step:
Remove the ‘downloader’ and ‘app/design/frontend/base’ directory


$ rm -rf downloader
$ rm -rf app/design/frontend/base

Copy ‘downloader’ and ‘app/design/frontend/base’ directory from the downloaded latest magento version


$ cp -a magento/downloader .
$ cp -a magento/app/design/frontend/base/ app/design/frontend/

Sixth Step:
Install/get ‘mage’ because ‘pear doesn’t work on any version higher than 1.4.2

If you upgrade Magento which is higher than 1.4.x then skip this step because Magento 1.5.x/1.6.x will intsall ‘mage’.


$ cp magento/mage .
$ chmod 550 ./mage

Seventh Step:
This step is most important for the upgrading process
Please carefully apply the following command-lines


$ ./mage mage-setup .
$ ./mage sync --force
$ ./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
$ rm -rf var/cache/* var/session/*
$ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
$ chmod 755 mage
$ php shell/indexer.php reindexall
$ ./mage upgrade-all --force

( NOTE: you may skip the ‘upgrade-all’ step and use the following command-lines instead )


$ yes | cp -Rf magento/* .

# this  will copy all the magento files over to your current installation

Eighth Step:
Visit the home page of your site and it will trigger the magento upgrading process. This can take anywhere bewtween 2-30 minutes, so stay patient. You’ll also likely get a browser error before the upgrade is done–don’t worry about it, it’s normal, and keep waiting…

Do the following and watch mysql process until it stops using up high cpu usage–once it does, you’ll know the database upgrade is done.


$ top

Ninth Step:
Login to the admin section of your site and make sure the version number reflects the version you’ve just upgraded to.

Tenth Step:
Change back your .htaccess to the original value


$ cp .htaccess-new .htaccess

Eleventh Step:
Set the proper file permissions


$ find . -type f -exec chmod 644 {} ;
$ find . -type d -exec chmod 777 {} ;
$ chmod -R 777 downloader
$ chmod 550 mage
$ chmod o+w var var/.htaccess app/etc
$ chmod -R o+w media

Twelfth Step:
You’ll probably want to use a file comparison program to see the difference in template files

• Download the latest version from magento connect if possible
• If not possible and you made your own template, then the best thing to do is DELETEing all the unnecessary custom template files from your custom template directory, and only keep the crucial ones.
• Then use something like Beyond Compare and file compare between the /base/default
app/design/frontend/base/default
and
/app/design/frontend/default/CUSTOM

Thirteenth Step:
Fix Magento URLs. In the admin interface admin/system_config/edit/section/catalog/ set the following under Search Engine Optimization:

• Autogenerated Site Map: enable
• Popular Search Terms: enable
• Product URL Suffix: blank
• Category URL Suffix: blank
• Use Categories Path for Product URLs: yes # or no depends on who you ask
• Create Permanent Redirect for old URLs if Url key changed: yes
• Page Title Separator: –
Use Canonical Link Meta Tag For Categories : yes
Use Canonical Link Meta Tag For Products: yes

Now re-index your url rewrite data in admin/process/list/: Catalog URL Rewrites

Or in SSH:


php shell/indexer.php reindexall

Note: If you want to upgrade Magento from 1.3 to 1.7 or 1.4 to 1.7 or 1.5 to 1.7 should be the same process. If you have Magento Theme Compatible with 1.5, you can use it bot for Magento 1.6 and 1.7 Version.

Hope you guys will find this post helpful and i look forward to hearing your suggestions.


Leave a Reply

Your email address will not be published. Required fields are marked *