Hi I have been looking for an answer to this all over however I cant find an answer that helps.

Whenever I try and reindex all of the data within the admin panel I seem to get this error:

enter image description here

So far I have tried changing the permissions of the 'media' folder to 777 and also tried dropping the core url rewrites table (I'm not sure if this is the correct name of the table but it's close).

Any idea what else I can do that might resolve this issue?

  • run the reindex from cli: php ./shell/indexer.php --reindex catalog_url - you have a 99% chance the shell indexer will simply output the exception/error reason to console
    – ProxiBlue
    Commented Apr 18, 2016 at 8:47
  • Also, have a look at this: github.com/EcomDev/EcomDev_UrlRewrite - using that alternative indexer - I have take a site that took 20 minutes to index to a couple of seconds. (0.14 minutes) - well worth the effort to install, and simply 'just works' - this was on magento 1.9
    – ProxiBlue
    Commented Apr 18, 2016 at 8:52

3 Answers 3


There can be numerous factors for such errors i.e.

php.ini maximum execution time & script input time error
apache/lighttpd timeout setting issue
number of products and store views
lock file from previous time preventing indexing to take place

Getting Rid Of Magento ReIndexing Errors

If even after trying multiple times Magento Indexer fails to respond or keep throwing same errors you can take the following steps resolve Magento ReIndexing errors.

  1. Locate var/locks directory and remove all files under this directory. This will clear all the locks for re-indexing to take place again.

  2. Now, login to your MysQSL/phpMyAdmin to run the following MySQL query (Ensure that your have taken full backup before committing this MySQL query)

    DELETE cpop.* FROM catalog_product_option_price AS cpop
    INNER JOIN catalog_product_option AS cpo
    ON cpo.option_id = cpop.option_id
    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
    cpo.type <> 'checkbox' AND
    cpo.type <> 'radio' AND
    cpo.type <> 'drop_down';
  3. Log back in to your Magento Admin panel and go to System tab > Index Management hit index again and you will notice no such errors will appear again. You can follow these same steps again if re-indexing stops in future to resolve Magento ReIndexing issues.

I would love to hear your experiences and questions about Magento Indexing, ReIndexing and indexing errors. Please leave me a comment and let me know.

The var/locks/ (note the "s") directory is created whenever you start an indexing process. Magento writes out a lock file to this directory. Removing the lock files may resolve issues with reindexing.

Like in previous Magento versions, in Magento 1.9 you can find this directory here:

[your Magento install dir]/var/

If the directory isn't there, Magento hasn't created it. If this is the case, then you should look for other solutions for fixing the reindexing issue.

Maybe your var directory doesn't have the right permissions. Magento needs sufficient permissions to be able to create the var/locks directory and write out the lock files. Try setting permissions for var to (at least) 755.

If this doesn't help, maybe you can reindex via SSH or try restarting your webserver.

  • I dont seem to have this 'var/locks' directory you have mentioned:puu.sh/kmlqE/272a520e6b.png Commented Sep 24, 2015 at 10:13
  • see my updated answer above Commented Sep 24, 2015 at 10:19
  • Before you do all that, simply run the reindex from cli: php ./shell/indexer.php --reindex catalog_url - you have a 99% chance the shell indexer will simply output the exception/error reason to console
    – ProxiBlue
    Commented Apr 18, 2016 at 8:47

You can re-index programmatically by using this code.

< ?php
//Following 3 lines will load the magento admin environment.
require_once 'app/Mage.php';
$app = Mage::app('admin');

// to reindex the processes we require their ids
// for default magento there are 9 processes to reindex, numbered 1 to 9. 
$ids = array(1,2,3,4,5,6,7,8,9);

// Sometimes there are processes from our custom modules that also require reindexing
// We need to add those ids to our existing array of ids
// To know the id of process, just hover on each process in your
// admin panel-> System-> Index Management
// You will get a url : admin/process/some_id/......
// this id corresponds to the process

$ids = array(1,2,3,4,5,6,7,8,9,390,391,478);
foreach($ids as $id)
//load each process through its id
$process = Mage::getModel('index/process')->load($id);
echo "Indexing for Process ID # ".$id." Done<br />";
catch(Exception $e)
echo $e->getMessage();
  • Hi I am quite new to Magento and I am just wondering how do I run this code programmatically? I have never done this before? Commented Sep 24, 2015 at 9:58
  • Put this code in your magento root folder and run it through url eg: www.yoursite.com/yourfile.php
    – Arunendra
    Commented Sep 24, 2015 at 10:04
  • Okay so I have tried running it and I get this "Fatal error: Class 'Mage' not found in /home/nickmadd/public_html/dev/g.php on line 4". Commented Sep 24, 2015 at 10:12
  • why not just use the core supplied shell indexer. this does not seem to add any value, to what is already supplied by magento in the shell indexer.
    – ProxiBlue
    Commented Apr 18, 2016 at 8:49

Please go to your db and truncate core_url_rewrite, go directly to your admin then reindex, It should work and you will no longer have your error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.