We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.
Contact Us
Contact Us
Sign in
Sign in
March 11, 2011

Upgrading to Magento
Magento version was released on February 9th, 2011. It adds a number of performance improvements in the areas of dataflow and checkout, and comes with the hot new Magento Mobile module installed. While we have not run into the same sorts of upgrade woes that plagued the 1.3 and 1.4 releases, the upgrade method itself has changed due to the new Magento Connect version 2.

Here at Nexcess, we perform upgrades via the command line, as it is quicker and we can better see what is happening should anything go wrong. The old tool for upgrading via SSH was the “pear” installer that came bundled with Magento. With the release of Magento 1.5.x, this tool will no longer work. Using it will only upgrade you as far as, however, it will download the new tool designed to work with Magento Connect 2.0 – the “mage” installer. The following outline how to upgrade to the latest version of Magento using the command line tools.

  1. First and foremost, always create a backup of your database and code before making any major changes. There are a few ways to do this, but the simplest is to use mysqldump and tar.
  2. Once you have everything backed up, you can use the “pear” tool to upgrade to the latest version on the old Magento Connect and also download the new “mage” tool.
  3. [bash]./pear upgrade -f magento-core/Mage_All_Latest-stable[/bash]

  4. When this is finished, don’t bother trying to fix errors. Just continue upgrading as some common errors will be fixed when you get to 1.5. In your magento root directory, you will see a new file called “mage”. First you want to make this script executable:
  5. [bash]chmod 550 ./mage[/bash]

  6. Now you can use the “mage” tool to finish the upgrade. The syntax is slightly different from the “pear” tool, but you can always type “./mage help” to see a list of commands, and “./mage help command” to see help for a specific command. First you initialize the new Magento Connect registry and channel:
  7. [bash]./mage mage-setup .[/bash]

  8. Edit 2011-07-19: As many of you have indicated in the comments, the default preference for the new “mage” tool is Beta. This will cause problems when Magento releases a beta or release candidate into the channel. To get around this, you just need to change the preferred state of the “mage” tool:
  9. [bash]./mage config-set preferred_state stable[/bash]

  10. Note that one significant change is that there is only one channel: connect20.magentocommerce.com/community. By putting everything into the “community” channel, I think Magento hopes to avoid the upgrade headaches that cropped up in previous versions. We’ll see why in a minute. Next you need to sync the old Magento Connect registry – the core and community extensions you already have – with the new 2.0 registry.
  11. [bash]./mage sync[/bash]

  12. You should hopefully see a list of all of your installed extensions, including your third-party extensions. As we move to the next step, note that the syntax we use will upgrade everything we have installed in the channel. So if your extension developer released a new version to match the new version of Magento, it will get upgraded as well. Also note that for some reason, we have to –force the upgrade, or else it won’t work.
  13. [bash]./mage upgrade-all –force[/bash]

  14. Once this is done, I highly recommend restricting access to your site to your own IP address. This is because that the first hit to your page will trigger the database upgrade. You want this process to go uninterrupted. You can do this in the .htaccess file by commenting out the default Access rules and putting in some temporary ones (don’t forget to change this back once you’re done):
  15. [bash] #Order allow,deny

    #Allow from all

    Order deny,allow

    Deny from all

    Allow from #CHANGE THIS TO YOUR IP ADDRESS[/bash]

  16. Finally, Open your site in your browser to trigger the database upgrade, and fix any errors that pop up. As I mentioned above, we haven’t come across any inherent upgrade bugs like there were in 1.3 and 1.4, and the move from 1.4.2 to is pretty seamless. You can now enjoy the new features and improved speed of the latest Magento Community offering.

Power up your sites and stores with custom-built technology designed to make every aspect of the digital commerce experience better. Make your digital commerce experience better with Nexcess.