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, 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

Magento Forum

How to call MAGMI datapump API from command line? 
Jr. Member
Total Posts:  13
Joined:  2008-12-02


I’ve just written a script for MAGMI datapump API to import products from an XML feed. All is working fine when I call the script through my web browser, except that it will often time out (I’m using NGINX - I get “504 Gateway Time-out”.

Could somebody show me how I can call my script from the command line? I tried “php ./integration/scripts/import.php” but that brought up notices and eventually an error “could not open input file: shell/indexer”.

Thanks in advance,


Magento Community Magento Community
Magento Community
Magento Community
Jr. Member
Total Posts:  28
Joined:  2010-10-21
Russian Federation


I’ve got the same error, but in my case I used bash script to run synchronization with some ERP system.

the string in my bash-script was:

usr/bin/php /var/www/magento/magmi/cli/magmi.cli.php -mode=create

Bad string!

Then, I looked at /magmi/inc/fshelper.php and /magmi/plugins/base/general/reindex/magmi_reindexing_plugin.php and found out that method exec_cmd looks uncomplete.
In my case this is it

public function exec_cmd($cmd,$params)
=shell_exec($cmd." ".$params);
catch(Exception $e)
->_lasterror=array("type"=>"remote execution error","message"=>$e->getMessage());
return $out;

if you debug it, as I did it, you can get something like this:

php shell/indexer.php --reindex ....

So, it means, if your current directory is not root of magento project, then you’ll see the error, like this

plugin;Magmi_ReindexingPlugin;info:Magmi Magento Reindexer v1.0.2 - Cleaning flat tables before reindex…
plugin;Magmi_ReindexingPlugin;info:Magmi Magento Reindexer v1.0.2 - running indexer
plugin;Magmi_ReindexingPlugin;info:Magmi Magento Reindexer v1.0.2 - Reindexing catalog_product_attribute....
plugin;Magmi_ReindexingPlugin;info:Magmi Magento Reindexer v1.0.2 - Could not open input file: shell/indexer.php

As you can see the problem in method exec_cmd or you can fix method updateIndexes in

replace string

$cl=$this->getParam("REINDEX:phpcli")." shell/indexer.php";
set this
$cl=$this->getParam("REINDEX:phpcli")." ".$_SERVER['DOCUMENT_ROOT']."/shell/indexer.php";

// or you can try this 

$cl=$this->getParam("REINDEX:phpcli")." ".MAGMI_BASEDIR."/shell/indexer.php";
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top