nilesh
Filed under - Development
No Comments so far. Add yours now

First Of All Check If Your Host Supports Magento

Important Note:  Before continuing to move your site make sure that your server has all the necessary software components installed. Do the Magento Server Compatibility Check as described here: http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento.

Here’s a PHP script you can upload to your website that will check if your host meets the server requirements for Magento.

Important Note: Magento requires the MySQL innodb table type. This script does not check for the innodb table requirement. Please manually verify your MySQL database supports inoodb before moving ahead.

Simply copy and paste the code below and save it as magento-check.php. Upload it to your website and then open it up in your browser.

If your host fails to meet the requirements for Magento, it will tell you what is missing.

<?php

extension_check(array(

‘curl’,

‘dom’,

‘gd’,

‘hash’,

‘iconv’,

‘mcrypt’,

‘pcre’,

‘pdo’,

‘pdo_mysql’,

‘simplexml’

));

 

function extension_check($extensions) {

$fail = ”;

 

if(version_compare(phpversion(), ’5.2.0′, ‘<’)) {

$fail .= ‘<li>PHP 5.2.0 (or greater)</li>’;

}

 

if(!ini_get(‘safe_mode’)) {

if(preg_match(‘/[0-9].[0-9]+.[0-9]+/’, shell_exec(‘mysql -V’), $version)) {

if(version_compare($version[0], ’4.1.20′, ‘<’)) {

$fail .= ‘<li>MySQL 4.1.20 (or greater)</li>’;

}

}

}

 

foreach($extensions as $extension) {

if(!extension_loaded($extension)) {

$fail .= ‘<li>’.$extension.’</li>’;

}

}

 

if($fail) {

echo ‘<p>Your server does not meet the requirements for Magento.’;

echo ‘The following requirements failed:</p>’;

echo ‘<ul>’.$fail.’</ul>’;

} else {

echo ‘<p>Congratulations! Your server meets the requirements for Magento.</p>’;

}

}

?>

 

Please note that if you see that MySQL is not compatible, it might not be the case, as your hosting account may not have SSH access (magento-check.php pulls the MySQL version via a shell command). The best way is to check this with your web hosting provider.

How to move Magento from one server to another

If you are a Magento developer sometimes you need to move the Magento eCommerce shop from one host server domain to new host server domain or from one directory location to another directory location. Migrating Magento to a new server is a simple task once you know how to do it. This “How to move Magento from one server to another” post will outline the steps involved to successfully migrate a Magento website.

1.       Back up the files in the old server.
Important Note:  Go to your old site admin backend and refresh Cache and disable by System > Cache Management. Then download and save the whole magento shop root directory via File manager or FTP tools.

2.      Export the magento Database.

Enter your server control panel phpmyadmin database area and EXPORT your magento shop database in to “name.sql.zip “format.

Important Note:  When we export database from old server then Below tables we need to only structure not data.

log_customer
log_visitor
log_visitor_info
log_url
log_url_info
log_quote
report_viewed_product_index
report_compared_product_index
report_event
catalog_compare_item

3.      Move magento files to the new server.

Upload the root directory (all the files) of your old magento shop backup taken on the step 1 in to the new server domain folder.

 

Important Note:  Once the files are copied, you should set the correct permissions for magento files and folders:
var and contents should have permissions “777″
media and contents should have permissions “777″
app/etc and contents should have permissions “777″

 4.      Import the database to the new server.

Go to your new host account phpmyadmin and create a new database, database user and database user password. Then open the database sql file saved on step 2 with a text editor and edit the database name mention in to the new database name, save it. Then import the “name.sql.zip “database backup saved on the step 2 in to this new database.

 

Important Note:  Magento database makes use of foreign key constraints to ensure database integrity. So if you attempt to import the mysql file that you exported using phpmyadmin you will get errors like

Cannot add or update a child row: a foreign key constraint fails

So Solution is:

 

So to import the sql file without constraint checking add the following statements at the beginning of the sql file.

 

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;

At the end of the mysql file add the following statements to enable constraint checking again.

 

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;

 

Now you will be able to import the mysql database without getting any errors.

 5.      Update the database details file.

Important Note:  Next step is to edit the database details file. To do this go to magento live site folder, find out “app/etc/local.xml” file and enter the latest Database details which is created on the step 4.

 

/app/etc/local.xml file like

 

<resources>

<db>

<table_prefix><![CDATA[db_prefix]]></table_prefix>

</db>

<default_setup>

<connection>

<host><![CDATA[db_host]]></host>

<username><![CDATA[db_user]]></username>

<password><![CDATA[db_password]]></password>

<dbname><![CDATA[db_name]]></dbname>

<initStatements><![CDATA[SET NAMES utf8]]></initStatements>

<model><![CDATA[mysql4]]></model>

<type><![CDATA[pdo_mysql]]></type>

<pdoType><![CDATA[]]></pdoType>

<active>1</active>

</connection>

</default_setup>

</resources>

 

You need to replace db_prefix db_host db_user db_password etc.. with your values.

 

 

6.   Modify the base URL database table.
Important Note: Next is to replace old server domain name with new domain name. For this go to your new server phpmyadmin magento database and modify core_config_data table as shown below.

a.      web/unsecure/base_url     >   http://www.newdomain.com/

b.      web/secure/base_url         >   http://www.newdomain.com/

 

with multiple stores you need also change:

path:                          value:
web/unsecure/base_url          http://[you_domain_here]/
web/secure/base_url            https://[your_secure_domain_here]/
web/unsecure/base_link_url     http://[your_domain_here]/
web/unsecure/base_skin_url     http://[your_domain_here]/skin/
web/unsecure/base_media_url    http://[your_domain_here]/media/
web/unsecure/base_js_url       http://[your_domain_here]/js/
web/secure/base_link_url       https://[your_secure_domain_here]/
web/secure/base_skin_url      https://[your_secure_domain_here]/skin/
web/secure/base_media_url    https://[your_secure_domain_here]/media/
web/secure/base_js_url         https://[your_secure_domain_here]/js/

 

7.       Refresh cache and Reindex Data from new server admin panel.

Important Note: The final step is to clear the cache. Go to your sites admin panel (Login with the old site username and password) System > Cache management > Select all & disable cache management. Then navigate through System—>Index Management. Select fields in Status — ‘REINDEX REQUIRED’, then choose ‘Reindex Data’ from drop down and click Submit or delete all the files in “var/session” and “/var/cache” folders of new site.

Take a look to your new magento ecommerce store frontend.

 

Tags:

Leave your comment

You must be logged in to post a comment.

Share IT © 2018. All rights reserved.