我遇到错误。它在本地有效,但不适用于生产。
有人有想法吗?
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