1. 运行环境
1). 当前使用的 Laravel 版本?
Laravel Framework 5.8.38
2). 当前使用的 php/php-fpm 版本?
PHP 版本:
PHP 7.3.24 (cli)
php-fpm 版本:
PHP 7.3.11 (fpm-fcgi)
3). 当前系统
Mac
2. 问题描述?
执行 php artisan migrate 报错
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateOrderProGModelTable extends Migration
{
/**
* Run the migrations. * * @return void
*/
public function up()
{
Schema::table('order_pros', function (Blueprint $table) {
$table->longText('g_name')->comment('商品名称')->change();
});
}
/**
* Reverse the migrations. * * @return void
*/
public function down()
{
}
}
3. 得到的结果?
chenxxx@MacBook-Pro cusdecsys % php artisan migrate
Migrating: 2021_12_24_111101_update_order_pro_g_model_table
PDOException : SQLSTATE[HY000]: General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances
at /Users/chenweile/Code/cusdecsys/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:209
205| throw Exception::invalidPdoInstance();
206| }
207|
208| $this->_conn = $params['pdo'];
> 209| $this->_conn->setAttribute(PDO::ATTR_STATEMENT_CLASS, [PDODriverStatement::class, []]);
210| unset($this->params['pdo']);
211| }
212|
213| if (isset($params['platform'])) {
Exception trace:
1 PDO::setAttribute()
/Users/chenweile/Code/cusdecsys/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:209
2 Doctrine\DBAL\Connection::__construct([Object(PDO), "test_dhcds", "pdo_mysql"], Object(Doctrine\DBAL\Driver\PDOMySql\Driver))
/Users/chenweile/Code/cusdecsys/vendor/laravel/framework/src/Illuminate/Database/Connection.php:900
Please use the argument -v to see more details.