Standard procedure to upgrade Magento to the newest version

Standard procedure to upgrade Magento to the newest version

I can’t give you exact recipe how to upgrade your specific Magento installation, but I’ll try to explain my standard procedure when getting Magento up to date.

1) Know what are you facing with:

Check google if there is something special about upgrading your specific version of Magento to the newest one.
If nothing else, you will be prepared with issues that you will need to solve.

2) Backup your files

We usually do it from CLI like this:
tar -cvvzf your_site_directory.tar.gz your_site_directory/ 2>error.log

3) Backup your database

You can also do it from CLI like this:

mysqldump -u THIS_IS_YOUR_USERNAME_FOR_DB -h localhost -pTHIS_IS_YOUR_USERNAME_FOR_DB my_database_name | gzip -9 > my_database_name.sql.gz

4) Copy those files to the new location

In case you need to move files between 2 servers, easiest way I can think of in CLI would be this:

scp /path_to_some_file/your_site_directory.tar.gz user@REMOTE_SERVER_ADDRESS:/some_dir_on_remote_server
You can do the same with your backup-ed database

5) Now it is time to import database into new created one:

a) Extract my_database_name.sql.gz

b) mysql –verbose –user=THIS_IS_YOUR_USERNAME –password=THIS_IS_YOUR_PASSWORD newly_created_db < my_database_name.sql

6) Now extract the files this way:

tar -xvvzf your_site_directory.tar.gz
This will extract all files to the current directory

7) Edit db table core_config_data and set new secure/unsecure URLs of your site

8) Disable cache from admin.

9) Delete cache and session directoriesΒ  located here:
/var/cache
/var/session

rm /your_path_to/var/session -R
rm /your_path_to/var/cache -R

10) Execute “clean” bash script located in /downloader/pearlib directory

a) Run chmod +x cleanΒ  to be able to execute this script
b) ./clean to execute script

11) Finally go to Magento connect manager from your Magento admin
Paste this extension to upgrade Magento: magento-core/Mage_All_Latest

After this is done, you should have new Magento, however if there was some custom coding, you should really know what is going on with your code.
Usually installation ends up with some minor problems that should be handled manually, sometimes even on default installations if you have really old version
of Magento that you would like to upgrade.

12) All that left is to test it and move those files on production server.

Note that this article is just for informative purposes and it is not meant to be tutorial, guide or whatever.
If I forgot something, I’ll update post.

You made it all the way down here so you must have enjoyed this post! You may also like:

How To Connect Google Analytics 4 To Magento 2 Bojan Mareljic
Bojan Mareljic, | 35

How To Connect Google Analytics 4 To Magento 2

3 best open-source eCommerce platforms in 2021 Zrinka Antolovic
Zrinka Antolovic, | 7

3 best open-source eCommerce platforms in 2021

eCommerce Returns Management – a simple solution from the Fashion industry Zrinka Antolovic
Zrinka Antolovic, | 12

eCommerce Returns Management – a simple solution from the Fashion industry

35 comments

  1. One question to Tomas Novoselic, may be silly question.

    Do we have to consider Magento Patch implementation in Upgrade process ?

  2. My website is developed in magneto 1.5 version. Need to upgrade in new version 1.9
    Below are the current asserts on my website:
    1. Db size Approx. 9 GB
    2. Total Products Approx. 50,000
    3. Total Orders 20,000
    4. Total customers 23,000

    I have followed below steps to achieve this but no luck.
    1. Created new instance for the same.
    2. Upgraded using Magento connect.
    3. Its upgraded successfully version is updated.
    4. But when i clear the cache and hit the url its infinite redirect loop.

    2nd Approach:
    1. Created new instance for the same.
    2. Merge the latest version core files and other js, lib etc.. files.
    3. Same when i hit the url its infinite loop.

    3rd Approach:
    1. Created new instance version 1.6
    2. And merge the theme and skin files and others that are required to run the theme.
    3. Configured the original db instance with this 1.6 version for upgrading the db.
    4. Made changes on Db as required.
    5. No luck again its loading and loading..

    Please suggest. How can i upgrade my store.

    Thanks In Advanced !!

  3. I was looking for some step by step tutorials at stackoverflow and magento commerce to upgrade Magento, but they are too complicated/ It seems to me – that it would take weeks if not months, plus you won’t be sure to check all the info while moving it into the upgraded store. I gues Cart2Cart service for migrating all your store info from the current to the new Magento installation. It now supports all the latest Magento versions, so whatever your current and potential Magento versions are, Cart2Cart ( http://www.shopping-cart-migration.com/) migration service will move your data pretty fast.

  4. Hey Tomas, great resource, thanks for this. I actually have a little tool I built recently that sort of automates a lot of the process of doing an upgrade. I’d be really curious to get your feedback on it, if you have a sec to check it out.

    It’s at mageupdate.com

    Thanks!
    Kalen

  5. Could you double-check the syntax for Step 3? It seems you have used username twice? Is that correct? I am going to be doing this soon and want to make sure.

  6. magento-core/Mage_All_Latest
    This extension key is not for magento connect 1.2
    can u plz provide me the extension key for magento connect 1.2

    Thanks in advance

  7. Can I upgrade magneto professional too in the same manner?
    My site is in 1.9.0.1 and I want to upgrade this in 1.11.

    Kindly suggest.

    Regards

  8. my site is now 1.3.2.4 and i tried to upgrade it on these steps.. but still getting error like:

    ## make sure to s” : 36270 calculated, 0 expected
    Download of “magento-core/Mage_Downloader” succeeded, but it is not a valid package archive
    Error: cannot download “magento-core/Mage_Downloader”

    And i am getting this error after this Command:
    ./pear upgrade magento-core/Mage_All_Latest

  9. Hi there,

    What about upgrade with magento connect 2.0, what is over there extension key, it;s not ‘magento-core/Mage_All_Latest’.

  10. I can’t add or edit products magento 1.5.0.1 its show me this error

    Fatal error: Call to a member function deletePriceData() on a non-object in C:\xampp\htdocs\magento-1-5-0-1\app\code\core\Mage\Catalog\Model\Product\Attribute\Backend\Tierprice.php on line 238

    Any solution how to remove this.

  11. Hi all

    My Customer installed 1.5 version already in the server.But we have developed with 1.4.1.The customer wants to use 1.5.

    What I have done.just copied my 1.4 tables to new server and update the theme files.

    I have no idea how to upgrade 1.4 db to 1.5 magento db.can any one have a look into this.please guide me If I am wrong

  12. as a non expert I find it very strange that the construction and working on the magento program so straightforward and simple until you come to upgrade which for a novice looks like a nightmare!. also it departs from language that is easy to understand to that secret language computer folk talk
    You can also do it from CLI like this:

    mysqldump -u THIS_IS_YOUR_USERNAME_FOR_DB -h localhost -pTHIS_IS_YOUR_USERNAME_FOR_DB my_database_name | gzip -9 > my_database_name.sql.gz

    I presume there is no easy way so what does anyone charge to perform an upgrade I presume once you know what you are doing and have done one it takes 5 mins!!

  13. Did we need the step 10 ?
    When i did this, installed community modules list disappeared …

    And after upgrade process.. i am not able to get the old community installed modules
    So can you please tell me the importance of Step 10

  14. Hi Tomas, thanks a lot for this detailed procedure to backup and restore and upgrade! Like it a lot.
    Screening the command lines, I’ve found a little typo at step no. 3 stating username twice (at option -p) — obviously a c&p issue.

    Maybe it’s worth correcting it so that couldn’t become an obstacle to anyone.

    cheers, jan.

  15. I urgently need to get my custom magento site working again after I upgraded. I am looking to hire.

  16. @Anton, I might look into setting it up and trying it out. I mostly use SVN so maybe I can setup a similar process.

    As for the templates, I work with a UX team who is always changing how the templates actually work. like adding stuff to layer navigation or other functionality that isn’t really that great in terms of usability out of the box from Magento. So its usually not a matter of just skinning the site.

  17. @dan

    if you used the procedure the on every upgrade you get :
    * list of new files
    * list of changed files
    * list of deleted files

    the rest is just:
    * comparing the changed files (only)
    * replacing/removing whats deleted
    * think if you need to do something based on new files

    the actual merging can be difficult of course dependent how the customization are done but you can make keeping track of it much easier.

    regarding to templates and theming , i see a rare case where you actually need to introduce a different DOM to a magento template and majority of magento templating can be handled within css (hail to magento for that) but of-course the clients and the needs are different.

    If you are behind a windows machine then winmerge (http://winmerge.org/) is your savior by helping to compare all your templates with one go and doing it that way will also give you to-do list that you can present to the client, give an estimate and so on.

  18. Ok Anton, you are right. Now let me go to work. There are some real sites and real clients that need my attention.
    Write an article somewhere on internet, I’ll try to drop few lines in your comments to act smart as well πŸ˜‰

  19. How many clients are doing the upgrading though? I am sure the process will be fine for any developer.

    Getting back to the templates it is still a pain to do all the diffing of a hundred files. Not to mention the layout xml changes that happen between versions and files that get deprecated and new ones are used. Its much more then just doing a diff. You might of edited some templates lets say in the catalog section and some of those files are no longer used.

    I know it takes some time but I am just saying I think the templates and layouts are the hardest part of upgrading.

  20. I guess it really depends on client’s knowledge and willingness to upgrade or to outsource this as a service. Or how much you hassle with educating clients or if they are willing to learn this.

    If you offer an upgrade as a service then there’s nothing there that stops using it internally initial commit (fresh version) to diff against just comes from client production env.

    Emulating and setting up the test instance to a sub-folder can be automated to shell script easily as the process is always the same, shell scripts can be executed via web interface and so on but yeah it really ends up how much $ is involved

  21. @Tomas my magneto (deployment) practices are mostly from experience with “agile” clients and tailored for teams or multiple teams. Currently I work (internationally) as a magento extension support person/developer.

    I don’t know what you mean by “you really don’t want everyone is able to do what you suggested” in fact I think that everyone needs to be able to do that (if in team then together) to ease their syncing pain with countless magento versions and their own (or 3rd party) modifications. It does not have to be magento that they might be versioning or even software.

  22. @Anton, would you like to come work with us? πŸ™‚ I really like your comments. Where are you from?

    In general, you are very very right, only thing is that when it comes to the project management you have this little problem:
    It is not an ideal world, so you will need do do some compromises when dealing with numerour clients.
    Not to get me wrong, clients are usually very well informed when it comes to Magento, but you just know a little bit more…so….yes, you are right but to work with a client in terms of http://en.wikipedia.org/wiki/Agile_software_development like we do, you just need your client to be able to preform some of described actions, so… it is all ok when dealing with low budget therefore simple shops, but in case of few K liners cost about CENSORED $, you really don’t want everyone is able to do what you suggested πŸ˜€

  23. @Dan you can always diff your modified templates against original templates overridden and if you have git or versioning (or if you don’t) you can make a triple diff to get the changes what needs to be updated on your site. On linux you have a diff , git has diff and so on, on windows you can use git bundled diff or winmerge that can compare entire folders

    @tomas it works the same no matter how big are modifications, local changes or kins need to be versioned also + you get to roll back or cherry pick your changes that you need to push to stage or production

  24. @Anton, interesting approach. We do something similar in case we are upgrading low risk (local development) Magento installations, but to be honest, I never used something similar for heavy modified client sites.

    @Dan You have a point, but in case we did our backend stuff the right way, none of template files wouldn’t be overridden the way Magento community is got used to (make your theme and put Varien’s files in same directory structure) in the first place.
    That’s why it is HARD (really) to do themes the right way. My personal attitude about Magento theming is that even though you set your theme in admin, in case you turn off your modules, your theme should look exactly like original. That can be achieved in case you update layout from your module to use a new template files even for smallest change. I’m not sure if I make any sense here πŸ™‚
    Maybe I went too far right now (and maybe I could make a post about it if I had the time), but I would like to point out one other approach which is actually impossible to practice because most of designers are not familiar what they are designing when it comes to Magento. Take a look at the post from my colleague Branko Ajzele: http://ajzele.net/how-to-properly-build-magento-theme-skinning-not-theming

  25. I think what you guys miss and so does Magento when talking about how easy it is to upgrade. Obviously if you do all your backend engineering the right way, it is easy enough to test that code. I think the biggest thing to overcome is the templates. If you did a huge modification to the Magento templates you have overridden a lot of files that most likely have additional code added to them for specific modules or other new functionality will not show up as styled.

    You could have a hundred files or more to go through and do diffs and then you don’t know what exactly is different because of the template that was used and what are actuall real code changes that need to be added to your templates.

  26. I use slightly different approach

    1. make a magento folder somewhere and run git init on this, download a magento version (or all versions) and branch it with version name (1.4.1.0, 1.4.1.1 and so on), commit
    2. each magento installation is a git version-ed installation, run your backup routines (for database mostly).
    3. git pull from origin (git pull origin 1.4.1.1) (to update the code-base) and git deals with upgraded files or deleted files that new magento version introduces. That way you get rid of all the unused files that magento has ditched and .gitignore will take care of ignoring cache, pear ,log and other files that does not need to be updated or included in version
    4. run the site to get the upgrades, test it out to see if it works

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.