0

So far I found this closed question and solutions for Magento 2, but I'm hoping there's a solution for Magento 1 as well. This question should not be closed like the other one because it IS specific to Magento 1.

In mysql, I checked what my local_infile variable looks like:

mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+

And yet, when I run my query, I still get the warning:

ERR (3): Warning: PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden  in /var/www/html/lib/Zend/Db/Statement/Pdo.php on line 228

Now, in Magento 2, the solution is to add a line in app/etc/env.php to say

'driver_options' => array(PDO::MYSQL_ATTR_LOCAL_INFILE => true)

However, in Magento 1, my file structure under app/etc/ has only a modules directory and the following files:

config.xml
local.xml
local.xml.additional
local.xml.template

As you can see, there is no env.php or any .php files at all, so I have no idea where that line would go, or if there's a completely different way to solve this.

  • What is the content of your /Statement/Pdo.php? LOAD DATA LOCAL INFILE is likely looking for a pattern that looks like data such as CSV or other type of data. Try bing.com search for "Magento load forbidden" for other clues. And here is another link. magento.stackexchange.com/questions/73134/… – Wilson Hauck Oct 29 '18 at 9:40
  • That file is totally irrelevant. It's just the _execute function. Line 228 is just the return statement from it: return $this->_stmt->execute($params); – ctrl-z pls Oct 29 '18 at 14:54
1

You can try this options to solve your problem.

Open the DB connection settings in the local.xml file and add this:

<driver_options>
         <MYSQL_ATTR_LOCAL_INFILE>true</MYSQL_ATTR_LOCAL_INFILE>
</driver_options>

If it doesn't work you can download the script here, copy it to your project in the appropriate directories and then in the connection setting of the local.xml file use this:

<secure_driver_options>
    <MYSQL_ATTR_LOCAL_INFILE>true</MYSQL_ATTR_LOCAL_INFILE>
</secure_driver_options>

You will receive something like this:

<config>
    <global>
        ...
        <resources>
            <default_setup>
                <connection>
                    ...
                    <secure_driver_options>
                        <MYSQL_ATTR_LOCAL_INFILE>true</MYSQL_ATTR_LOCAL_INFILE>
                    </secure_driver_options>
                    ...
                </connection>
            </default_setup>
        </resources>
        ...
    </global>
</config>
  • Adding driver options to the config file did not work for me unfortunately. But I haven't tried the script yet. – ctrl-z pls Oct 29 '18 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.