Saturday, November 28, 2015

Solve Re-indexing Error `Cannot initialize the indexer process` in Magento

If you have a Magento store than whenever you changes in attributes or product or category settings than must re-indexing data for regenerate all products URL and relation with others in website.Re-indexing website data from Admin panel  System -> Index Management.
But sometimes seen error "There was a problem with re-indexing process" or "Cannot initialize the indexer process" and all data not re-indexing mostly category flat data,product flat data.This error because of products,categories or stores and execution time.
Solve this error with follow one or more of below solutions.Must backup of your website with database before applying any method.

#Solution - 1

 

Enter into phpMyAdmin and find all tables with `PREFIX_catalog_product_flat_%` and `PREFIX_catalog_category_flat_store_%` truncate all tables and than after clear Magento caches and than try to re-indexing data


#Solution -2

 

This type of error because of large database and small execution time so increase execution time by write below code in .htaccess file.
   php_value memory_limit 256M  
   php_value max_execution_time 18000
You can also increse memory limit by writing below code in index.php file
   ini_set("memory_limit","256M");
   ini_set('max_execution_time',18000);

 

#Solution -3

 

Create new reindex.php file in magento root folder and add below code on that file.

<?php  
 require_once 'app/Mage.php';  
 $app = Mage::app('admin');  
 umask(0);  
 for ($index = 1; $index <= 8; $index++) {  
     $process = Mage::getModel('index/process')->load($index);  
     $process->reindexAll();  
 }
 ?>
than clear all caches and run file on browser as http://www.YOURSITE.com/reindex.php you can also use below shell script for run this file.
php shell/indexer.php reindex all

 

#Solution -4

 

 Enter into magento root directory clear all folder in var/ directory and set file permission as '777' including all sub folders.than run below two query in phpMyAdmin according to database prefix.
    DELETE cpop.* FROM catalog_product_option_price AS cpop
    INNER JOIN catalog_product_option AS cpo
    ON cpo.option_id = cpop.option_id
    WHERE
    cpo.type = 'checkbox' OR
    cpo.type = 'radio' OR
    cpo.type = 'drop_down';
    
    DELETE cpotp.* FROM catalog_product_option_type_price AS cpotp
    INNER JOIN catalog_product_option_type_value AS cpotv
    ON cpotv.option_type_id = cpotp.option_type_id
    INNER JOIN catalog_product_option AS cpo
    ON cpotv.option_id = cpo.option_id
    WHERE
    cpo.type <> 'checkbox' AND
    cpo.type <> 'radio' AND
    cpo.type <> 'drop_down';
After execute query clear all caches and re-indexing data.

 

#Solution -5

 

Enter into phpMyAdmin and find table `PREFIX_catalog_category_product_index`drop table from database (Disable foreign key using "SET FOREIGN_KEY_CHECKS=0").
Reset foreign key using "SET FOREIGN_KEY_CHECKS=1"than run below code in phpMyAdmin.
    ALTER TABLE `catalog_category_product_index`
    ADD CONSTRAINT `FK_CATALOG_CATEGORY_PROD_IDX_CATEGORY_ENTITY` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `FK_CATALOG_CATEGORY_PROD_IDX_PROD_ENTITY` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE;
After execute query clear all caches and re-indexing data.

No comments :

Post a Comment