Site: US UK AU |
Nexcess Blog

Upgrading to Magento

March 11, 2011 23 Comments RSS Feed

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. ./pear upgrade -f magento-core/Mage_All_Latest-stable

  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. chmod 550 ./mage

  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. ./mage mage-setup .

  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. ./mage config-set preferred_state stable

  10. Note that one significant change is that there is only one channel: 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. ./mage sync

  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. ./mage upgrade-all --force

  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.     #Order allow,deny<br />
        #Allow from all<br />
    Order deny,allow<br />
    Deny from all<br />

  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.
Posted in: Magento
  • Great write-up, this is much easier than going through Magento Connect in the beginning and helps avoid some of the gotchas.

    In step 6, the force command is actually “–force” (note the two dashes), otherwise this worked very well.


  • better set magento default themes ,or more errors

  • L. Arnold

    Have been following these steps but
    ./mage upgrade-all –force
    is causing problems. Alternatively it is wanting or and I can only have one or the other. If I turn them both off (apt-get remove …) it is calling for both.

    Is there some place in settings where I can turn this requirement off (or these cache settings?) My Ubuntu only has php5-xcache installed in it right now.

    Seems to be that many references to both cache systems are built into Magento. How to control this and complete an upgrade. I have 1.5 downloader working w/ Mage installed, but no FINAL UPGRADE has been finished.

    thank you for any help.

  • Ben

    Right. If you’re using an old theme, it will throw errors due to the changes Magento made to the system. However, changing the theme to default isn’t a solution. Particularly if you’ve invested money and programming-hours into developing it. The solution is to check the Magento release notes and update your theme accordingly.

  • Ben

    Magento’s backend cache settings are configured in the app/etc/local.xml file. You can use the default filesystem cache by deleting everything between and including the “cache” tags.

  • L. Arnold

    Good instructions. Thank you. I eleminated the call so beyond the part referenced above. Now the problem seems to be I have PHP 5.3 and getting the error referenced here: (no fun)

    Earlier Today tried an alternative of svn to 1.5 on the same machine… Copied local.xml /media folder and /downloader folder. Downloader part appeared to work then reference to all extensions dropped… May try again just dropping all extensions, running SVN based upgrade, then reinstalling extensions but this is a lot of work on the back end.

    Is there any way to drop an SVN on the folder or a Package on the system so it just upgrades… I have somehow ended up with ver. 1.5.0 downloader Installed but can’t get the main system past 1.4.2 ..

    Probably not the place to be looking for help, but the instructions have been a way past magento connect problems. Thanks again.

  • L. Arnold

    The whole magento-core/Mage_Upgrade_All process is not working with PHP 5.3. You would think that if Magento requires 5.28 it could deal with 5.3….

    The other options are wget via SSH (or basically dropping a Tarball on the folder) and svn (Subversion).

    I am afraid of messing up some core files on running Magento. Do I need to be worried about this?

  • Sean


    Could you please detail the error that you’re getting? How are you determining that PHP 5.3 is the cause of the error when upgrading? The Magento core files DO get changed when you upgrade, so I’d suggest backing up all of your files and a dump of the database right before the upgrade.

  • Mark

    Thanks so much! this worked perfectly for me.

  • If anyone is wanting to run the new “mage” script in Windows, I created a little batch file, mage.bat. It does the same thing as the “mage” Bash shell script included with 1.5, but it’s for Windows. Useful if you are developing on a WAMP box, like me. Here’s the link:

  • There is a lot of confusion about this upgrade on the web and your guide helped me complete the process smoothly. Thanks!

  • Maks Markovets

    Thanks it works perfectly, but for now it upgrades magento to vertion How to upgrade only to last stable version of magento (

  • Maks Markovets

    Thanks it works perfectly, but for now it upgrades magento to vertion How to upgrade only to last stable version of magento (

  • i’m trying to upgrade from, and now i’m seeing an “500 Internal Server Error” when accessing my store. Any tips as to where to look to correct this?

  • Thanks for the lesson. I’m stuck in a loop. I keep receiving a message to ‘please initialize magento connect installer…’ I’ve ran the command ./mage mage-setup several times with confirmation “Running initial setup…” Any ideas as to what’s happening?

  • same problem as Rodney

  • François Létocart

    If you wanna upgrade to a specific version replace this :
    ./pear upgrade -f magento-core/Mage_All_Latest-stable
    By this :
    ./pear upgrade -f magento-core/Mage_All_Latest-YOURVERSIONHERE (magento-core/Mage_All_Latest- for example)

  • Greetings Mage Folks
    If in case you want to upgrade your Magento from to via diff files then you can try the following article:

    At least this worked for me great.


  • Toinus

    Did you find a solutionto this issue ? Same for me…

  • Toinus

    Did you find a solution to this issue ? Same for me…

  • Izik Dubnov

    Had same problem.

    Fixed by adding these lines to “downloader/mage.php”:

    if (!defined(‘STDIN’))
    define(‘STDIN’, fopen(‘php://stdin’, ‘r’));
    if (!defined(‘STDOUT’))
    define(‘STDOUT’, fopen(‘php://stdout’, ‘w’));
    if (!defined(‘STDERR’))
    define(‘STDERR’, fopen(‘php://stderr’, ‘w’));

    before (3rd line from end):

    if (defined(‘STDIN’) && defined(‘STDOUT’) && (defined(‘STDERR’))) {

  • Toinus

    This works for me indeed !
    Thank you so much Izik :)

  • Régis Laval

    It’s work for me too!

    Thank you Toinus :)