Today I spent some time to upgrade my shopping website from Magento CE 1.8 to Magento CE 1.9. In order to upgrade I first tried to do the upgrade on my own in my localhost under XAMPP and I am sharing the same in this blog.
1. Latest Magento Package. Magento 1.9 was the latest at this point in time.
2. SSH connection to production server to download the production magento database
3. XAMPP setup up and running
Step 1 – Setup your Localhost
1. Go to http://www.magentocommerce.com/download and download the Magento 1.9 CE version in ZIP format
2. Create a folder called ‘mag19’ under localhost xampp folder
3. Unzip the downloaded Magento 1.9 ZIP file and uncompress inside ‘mag19’ folder
4. Open PhpMyadmin and create a database called ‘mag19db’
Step 2 – Clear Cache in production
1. Login to admin side in production Magento website
2. Navigate to System -> Cache management and flush all cache
Step 3 – Take necessary backups from production
1. Open Putty Software (SSH) and connect to your production server and execute the below command
mysqldump -u @username@ -p @dbname@ > db-m18.sql
@username@ – The database username. You can get it from DB Manager in the hosting control panel
@dbname@ – The production database name. You can get it from PhpMyAdmin in control panel
Keyin the password when it asked.
The above command will take the backup of the current production database and put it inside db-m18.sql file. The file will be available in the current path. Execute ‘pwd’ to see which path you are.
2. Connect to the server via any FTP client and download the db-m18.sql file from the path to your localhost.
3. Archive and download the Media, Design, Code & Configuration from production.
Download the below folders and files to localhost
[your Production Magento install dir]/media [your Production Magento install dir]/app/design/frontend [your Production Magento install dir]/skin/frontend [your Production Magento install dir]/app/code/local [your Production Magento install dir]/app/code/community [your Production Magento install dir]/app/etc/local.xml
Step 4 – Restore the Production Backup files to Localhost
1. Copy the db-m18.sql from the downloaded folder to xampp\mysql\bin folder
2. Open a DOS prompt and navigate to xampp\mysql\bin folder
3. Execute the below command to import the database
mysql -u @username@ -p mag19db < db-m18.sql
Note: My database was around 1GB and it took 30 minutes to import the database
4. Copy the backup folders and files to the localhost
[your Localhost Magento install dir]/media [your Localhost Magento install dir]/app/design/frontend [your Localhost Magento install dir]/skin/frontend [your Localhost Magento install dir]/app/code/local [your Localhost Magento install dir]/app/code/community [your Localhost Magento install dir]/app/etc/local.xml
Note: Do not delete the localhost folders. Just overwrite the localhost folders with production folders
Step 5 – Edit the localhost local.xml file
1. Navigate to app/etc/ folder and edit the local.xml file in the notepad
2. Under the default_setup tag, edit the username, password and db name
3. Save the file there itself
Step 6 – Change the localhost base URL
1. Open PhpMyadmin on your localhost and navigate to mag19db SQL database
2. Find and open the table ‘xxx_core_config_data and execute the below SQL command
SELECT * FROM `xxx_core_config_data` where path like ‘%base_url%’
Note: xxx is the table prefix. Replace with your own
3. You will be seeing 2 rows as below
4. Edit each row and change the value to ‘http://localhost/mag19/’ and save
Step 7 – Finalize your installation
1. Just launch the localhost URL as http://localhost/mag19
2. For the first time it will take longer than usual because it will run few upgrade scripts
I captured all the above 7 steps in parallel while I was doing the actual setup. It worked great but I found that the product images are not loaded in the homepage. This was because a .htaccess file was introduced inside the Media folder in the Magento 1.9 version for security reasons.
I navigated to mag19\media folder and edited the .htaccess file and uncommented the below line as below
Options All -Indexes
And commented the below line
#Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
Honestly I am not sure will this impact any of the security reasons.