Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Reindex once a day with magento 1.4
 
Stephan Wienczny
Jr. Member
 
Total Posts:  19
Joined:  2008-11-04
 

Magento 1.4.0 supports index on save/update and manual. How can I run the index from cron once a day?

 
Magento Community Magento Community
Magento Community
Magento Community
 
seanbro
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2009-03-30
 

Does anyone know how to do this? I’d like to reindex Product Attributes via cron job.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Stephan Wienczny
Jr. Member
 
Total Posts:  19
Joined:  2008-11-04
 

The distribution contains a new folder ‘shell’. It contains some php-cli applications. One of those reindexes your db. All you have to do is add it to your cron setup.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Red Mouse Computers
Sr. Member
 
Total Posts:  123
Joined:  2009-10-04
 
Stephan Wienczny - 08 March 2010 02:31 AM

The distribution contains a new folder ‘shell’. It contains some php-cli applications. One of those reindexes your db. All you have to do is add it to your cron setup.

Thanks. it worked.

 
Magento Community Magento Community
Magento Community
Magento Community
 
seanbro
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2009-03-30
 

I keep getting a message saying “PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 140 bytes) in /var/www/vhosts/mywebsite.com/httpdocs/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php on line 32” when I try to execute indexer.php from the command line. Even if I’m just using the “info” command. The “help” command works fine however. I have set both my server’s php.ini file to 128M and the .htaccess file to 128M, but for some reason it is being overridden by some file loaded via indexer.php. Any ideas on how to overcome this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paulus
Guru
 
Total Posts:  335
Joined:  2008-07-21
 
seanbro - 26 April 2010 01:23 PM

I keep getting a message saying “PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 140 bytes) in /var/www/vhosts/mywebsite.com/httpdocs/app/code/core/Mage/Index/Model/Mysql4/Process/Collection.php on line 32” when I try to execute indexer.php from the command line. Even if I’m just using the “info” command. The “help” command works fine however. I have set both my server’s php.ini file to 128M and the .htaccess file to 128M, but for some reason it is being overridden by some file loaded via indexer.php. Any ideas on how to overcome this?

Same issue here all of a sudden, any fixes?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tacgear
Member
 
Total Posts:  52
Joined:  2009-06-14
 

Try commenting out php_value memory_limit and php_value max_execution_time in your .htaccess file. If you’re using a php.ini file to set your memory limit and your execution time it conflicts with your .htaccess file.

On a side note… When I run this command through a cron job I get ALL results instead of the “indexer” I’ve specified. For example

/usr/local/bin/php -/home/accountname/public_html/shell/indexer.php -- status 7
Provides the following results:

Product Attributes:  Pending
Product Prices:  Pending
Catalog Url Rewrites:  Require Reindex
Product Flat Data:  Require Reindex
Category Flat Data:  Pending
Category Products:  Require Reindex
Catalog Search Index:  Require Reindex
Stock status:  Require Reindex

I only want status for one indexer (number 7, the Catalog Search Index). Is my syntax wrong or is this just broken?

 
Magento Community Magento Community
Magento Community
Magento Community
 
martinhill27
Jr. Member
 
Total Posts:  1
Joined:  2010-02-23
 
Tacgear - 10 June 2010 10:07 AM

Try commenting out php_value memory_limit and php_value max_execution_time in your .htaccess file. If you’re using a php.ini file to set your memory limit and your execution time it conflicts with your .htaccess file.

On a side note… When I run this command through a cron job I get ALL results instead of the “indexer” I’ve specified. For example

/usr/local/bin/php -/home/accountname/public_html/shell/indexer.php -- status 7
Provides the following results:

Product Attributes:  Pending
Product Prices:  Pending
Catalog Url Rewrites:  Require Reindex
Product Flat Data:  Require Reindex
Category Flat Data:  Pending
Category Products:  Require Reindex
Catalog Search Index:  Require Reindex
Stock status:  Require Reindex

I only want status for one indexer (number 7, the Catalog Search Index). Is my syntax wrong or is this just broken?

If you read the usage, it says php -f indexer.php—[options]. If you check the php CLI usage, it says:

args… Arguments passed to script. Use—args when first argument
starts with - or script is read from stdin

So to get what you want, you should be doing “php -f indexer.php—--status 7” without quotes. That is if 7 is a valid indexer.

 
Magento Community Magento Community
Magento Community
Magento Community
 
senza
Jr. Member
 
Total Posts:  16
Joined:  2009-03-26
 

hi,
I found that you must use the string code instead the number code; for example to verify the status of \"Product Attributes\” you must put

--status catalog_product_attribute
instead of
-- status 1

this is the list of string codes:

catalog_product_attribute Product Attributes
catalog_product_price Product Prices
catalog_url Catalog URL Rewrites
catalog_product_flat Product Flat Data
catalog_category_flat Category Flat Data
catalog_category_product Category Products
catalogsearch_fulltext Catalog Search Index
tag_summary Tag Aggregation Data
cataloginventory_stock Stock Status

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jose M Moreno
Member
 
Total Posts:  58
Joined:  2008-09-01
 

When I run indexer.php reindexall from php ssh shell I’ve got this:
The script whose uid is 10001 is not allowed to access /var/www/vhost/..,,,,./httpdocs/var/log/system.log owned by uid 48
Tell me that is a SAFE MODE Restriction in effect.

Anyone can help me?

Thanks and best regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

You can solve this problem using asynchronus queue.  Check this one Fast Asynchronous Re-indexing http://mirasvit.com/magento-extensions/magento-asynchronous-reindex.html. After each product/category save this extension move reindex task to queue and process this queue as background process in cron.

 
Magento Community Magento Community
Magento Community
Magento Community
 
maurisource
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2011-11-21
Montreal, Canada
 

Anybody reading this today even using newer version of Magento, this is helpful for big stores that cannot reindex via the backend.

Here’s is how to automate the Reindex using cron.

In Cpanel use the cron job and paste this:

php -/home/username/public_html/magento-dir/shell/indexer.php reindexall

Use the correct path to your magento indexer.php.

Tune the time for once every hour for example.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top