Laravel未定义类常量MYSQL_ATTR_LOCAL_INFILE

时间:2018-03-26 09:10:56

标签: mysql laravel pdo

我收到了错误消息。本地工作,但不是生产。

有没有人有想法?

PHP版本7.1.14-1 + ubuntu16.04.1 + deb.sury.org + 1

Mysql Version 5.7.21

错误:

production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Undefined class constant ‘MYSQL_ATTR_LOCAL_INFILE’ in /data/www/xxx/config/database.php:50

数据库:

    'default' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST'),
        'port' => env('DB_PORT'),
        'database' => env('DB_DATABASE'),
        'username' => env('DB_USERNAME'),
        'password' => env('DB_PASSWORD'),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => false,
        'engine' => null,
        'options'   => array(
            \PDO::MYSQL_ATTR_LOCAL_INFILE => true,
        ),
    ],

enter image description here

1 个答案:

答案 0 :(得分:0)

  

使用这些命令安装或启用PDO模块

sudo apt-get install php7.1-mysql

sudo phpenmod pdo_mysql

sudo service apache2 restart