2

i'm working on a magento CE 1.7.0.2 and I have to update indexes from shell. However I'm trying the commands:

php -f indexer.php info

and also

php -f indexer.php -- -reindex catalog_url

but they don't show any output.

UPDATE

If I add -d display_errors=1, it returns:

Fatal error: Call to a member function getSingleton() on a non-object in indexer.php on line 45

Any idea why? thanks so much

2 Answers 2

3

Looks like you have shell/indexer.php from Magento 1.8 or 1.9 but shell/abstract.php from Magento 1.7

Since Magento 1.8 line 45 is

return $this->_factory->getSingleton($this->_factory->getIndexClassAlias());

while in 1.7 it was

return Mage::getSingleton('index/indexer');

The _factory property is instantiated in the constructor of Mage_Shell_Abstract and was introduced in Magento 1.8

Solution

Restore the original indexer.php file from Magento 1.7. You can get it here: https://github.com/OpenMage/magento-mirror/blob/magento-1.7/shell/indexer.php

-1

Assuming you're in documentRoot/shell/

The correct syntax would be php indexer.php --info (with or without the -f flag depending on your preference).

To re-index you can ommit the -- and make reindex have -- like this: php indexer.php --reindex catalog_url

Take a look at http://www.branded3.com/blogs/re-indexing-magento-command-line/ for more info.

2
  • 1
    According to help output, info (no longopt!) is absolutely correct. However, the argument parsing does not care at all if you prepend slashes or not. So -info and --info will lead to the same result.
    – mam08ixo
    Commented Apr 1, 2015 at 12:58
  • it returns same empty output :(
    – apedic
    Commented Apr 1, 2015 at 13:34

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.