0

I am trying to automate magmi with a script

<?php
class Trainingsatyendra_Feedback_IndexController extends Mage_Core_Controller_Front_Action
{
        public function indexAction()
        {

    exec('localhost/practice/magmi/web/magmi_run.php?mode=create&pr
    ofile=default&engine=magmi_productimportengine:Magmi_ProductImportEngine&CSV:f
    ilename=catalog_product_20130422_073721.csv',$result);
        var_dump($result);
         if($result)
        {
        echo "shell successfully executed";
        }
        else
        echo "shell Not executed";

        } 
    }

    ?>

The above code is written in my controller file. when i copy and paste the the below code in browser url it works giving me output on the browser

localhost/practice/magmi/web/magmi_run.php?mode=create&pr
ofile=default&engine=magmi_productimportengine:Magmi_ProductImportEngine&CSV:f
ilename=catalog_product_20130422_073721.csv

However it dosen't work if i try to use exec or shell_exec in my controller.

Havelock
  • 6,913
  • 4
  • 34
  • 42
Satyendra Mishra
  • 523
  • 2
  • 9
  • 21

2 Answers2

1

I was also seeing the same response but after few tries ended up changing the folder permissions to apache:apache the user which the service apache was running with and it worked.

Lee
  • 11
  • 1
0

According to the documentation you either have to use wget, i.e.

exec('wget http://localhost/practice/magmi/web/magmi_run.php?mode=create&profile=default&engine=magmi_productimportengine:Magmi_ProductImportEngine&CSV:filename=catalog_product_20130422_073721.csv');

or use an appropriate cli command, i.e.

exec('magmi [cli_command']);

or maybe even better you use cURL to fetch whatever is needed over HTTP(S).

Havelock
  • 6,913
  • 4
  • 34
  • 42