Dan
Dan

Reputation: 9

Error on Magmi after move to another server

I just moved to another server and cannot reindex with Magmi, I receive the error below:

This script cannot be run from Browser. This is the shell script.

Thanks!

Upvotes: 0

Views: 854

Answers (1)

Axel
Axel

Reputation: 10772

This error occurs when you run Magmi from the browser, because Magmi runs the indexer using shell_exec command, and the $_SERVER['REQUEST_METHOD'] doesn't get unset.

You can try one of two things.

Method 1. Unset the $_SERVER['REQUEST_METHOD'] variable Magento uses to check if the shell file is being run from the browser.

To do this, open magmi/plugins/base/general/reindex/magmi_reindexing_plugin.php

Find:

    public function updateIndexes()
    {

At the top of the updateIndexes() function, add the following:

    if(isset($_SERVER['REQUEST_METHOD']))
    {
        unset($_SERVER['REQUEST_METHOD']);  
    }

So it will look like this:

    public function updateIndexes()
    {
        if(isset($_SERVER['REQUEST_METHOD']))
        {
            unset($_SERVER['REQUEST_METHOD']);  
        }

Method 2: Modify the _validate() function in [magento_root]/shell/abstract.php

Open [magento_root]/shell/abstract.php

Find:

    protected function _validate()
    {
        if (isset($_SERVER['REQUEST_METHOD'])) {
            die('This script cannot be run from Browser. This is the shell script.');
        }
    }

Replace with:

    protected function _validate()
    {
        if (isset($_SERVER['REQUEST_METHOD'])) {
            //die('This script cannot be run from Browser. This is the shell script.');
        }
    }

Upvotes: 1

Related Questions