You can configure PDO :: MYSQL_ATTR_LOCAL_INFILE using configuration files in Symfony2

Is it possible to set the PDO / Doctrine configuration in Symfony2 for use PDO::MYSQL_ATTR_LOCAL_INFILE => truewithout using PDO directly?

My use case is loading a csv file into MySQL on Amazon RDS. Symfony version 2.4.

I get an error message:

PHP Warning:  PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden in /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Statement.php on line 165
+4
source share
1 answer

Yes, you can install it in your config.yml:

doctrine:
    dbal:
        options:
            "PDO::MYSQL_ATTR_LOCAL_INFILE": 1

The key must be specified due to the presence of colons.

+5
source

Source: https://habr.com/ru/post/1536985/


All Articles