While reindexing "Product Flat Data", I am getting the following error message, "Cannot initialize the indexer process". Please suggest how to fix this and allow reindexing.
Magento – “Cannot initialize the indexer process.” error while Reindexing Product Flat Data Index
indexingreindex
Related Solutions
Svetoslav,
In the future please post the specs about your hosting OS, version of Magento, etc. I am going to just post some typical solutions to your problem.
Run Indexing from the CLI
from the CLI at the root of your magento installation
php shell/indexer.php --reindex catalog_product_price
No folders in var/
Make sure that the
var/
folder has the correct file permissions and ownership. Magento needs to write to those folders.I recently ran across an install of magento that located the var folder in the root tmp folder of the server, you may want to check there. It was located in
/tmp/magento/var/
If your var folder is located there, it is because you have a permissions issue.
Change your memory limit
I agree with sean! Change this in your .htaccess
that is located in your site root
ini_set('memory_limit','2048M');
To resolve the "Cannot initialize the indexer process" you need to run follow below step
Solution 1 :-
This is usually occurred when we Enable "Use Flat Catalog Category" and "Use Flat Catalog Product"
Please connect SSH via Putty run below command:-
These is Individual commands for re-indexing:-
php shell/indexer.php --reindex catalog_category_flat
php shell/indexer.php --reindex catalog_category_product
php shell/indexer.php --reindex catalogsearch_fulltext
OR run all re-indexing:-
php shell/indexer.php --reindexall
Then clear the magento all cache.
Solution 2 :-
Try to run indexing with PHP script file. Create a file reindex_custom.php in the root.
<?php
require_once("app/Mage.php");
Mage::app('default');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try{
$indexerByShell = Mage::getBaseDir().'/shell/indexer.php';
if(file_exists($indexerByShell))
{
$indexListByCode = array(
"catalog_product_attribute",
"catalog_product_price",
"catalog_product_flat",
"catalog_category_flat",
"catalog_category_product",
"catalog_url",
"catalogsearch_fulltext",
"cataloginventory_stock"
);
//reindex using magento command line
foreach($indexListByCode as $indexer)
{
echo "reindex $indexer \n ";
exec("php $indexerByShell --reindex $indexer");
}
}
}catch(Exception $e){
echo $e;
}
?>
Then clear the magento all cache and run this file as http://domain.com/reindex_custom.php
Best Answer
Based on the error you specified in the comment, I can conclude that you cannot use the flat product tables. It's exactly what I was saying here. You have too many attributes (or too large values) used in product listing. Edit your product attributes and change the field
Used in product listing
tono
for the attributes that are not needed in the product list.If they are not that many, you may want to remove from product list the product description or any other field that has long values.
[EDIT]
If you don't want to remove attributes from product listing you need to disable the flat products. The website will work a little (or a lot) slower, but at least it will work.