我收到一个错误。它在本地有效,但不适用于生产。
有人有主意吗?
PHP版本7.1.14-1 + ubuntu16.04.1 + deb.sury.org + 1
MySQL版本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,
),
],
最佳答案
使用以下命令安装或启用PDO模块
sudo apt-get install php7.1-mysql
sudo phpenmod pdo_mysql
sudo service apache2 restart
关于mysql - Laravel未定义的类常量MYSQL_ATTR_LOCAL_INFILE,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49487776/