Moving Magento site from development server to live server
Recently I faced problem to move magento site from local (LAMP) environment to web server. I am posting steps to upload site on server.
1. Make tar / zip of code.
$ tar -cvvf site.tar /opt/lampp/magento/
2. Take backup of database through phpmyadmin. Check “Disable foreign key checks” to avoid error in restore process.
3. Open backup sql file and add following
In beginning
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’;
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;
and following in the end of file
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;
SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;
SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;
SET SQL_NOTES=@OLD_SQL_NOTES;
4. Upload tar / zip file on web server, extract and deploy. Don’t forget to clear cache (Clear /var/cache and /var/session directories).
tar -xvvf site.tar
5. Change /var permission to 777 recursively.
$ chmod 777 /home/magento/htdocs/var
6. Restore database on server through phpmyadmin.
7. Change mysql database setting in
/app/etc/local.xml
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[database_username]]></username>
<password><![CDATA[database_password]]></password>
<dbname><![CDATA[database_name]]></dbname>
<active>1</active>
</connection>
8. Run website.
If you are getting blank page then check the following
1. Mysql Database setting.
2. Did you clear cache?
3. Followed step3?
If you are getting Undefined index 0 Error then check the following
1. Did you followed step3?
2. Or you can manually run these queries
UPDATE `magento`.`core_website` SET `website_id` = ‘0’ WHERE `core_website`.`code` = ‘admin’ LIMIT 1 ;
UPDATE `magento`.`core_store` SET `store_id` = ‘0’ WHERE `core_store`.`code` = ‘admin’ LIMIT 1 ;
Clear cache as you make any change.