[英]PDO Exception:SQLSTATE[HY000] [2006] MySQL server has gone away with xampp
I'm trying to connect to the database and fetching some records but I'm getting error: Error i'm getting 我正在尝试连接到数据库并获取一些记录,但我收到错误: 错误我得到了
I'm using Slim PHP framework and slim-twig to render views so my code for the connection file is: 我正在使用Slim PHP框架和slim-twig来渲染视图,因此我的连接文件代码是:
<?php
use Payment\App;
use Illuminate\Database\Capsule\Manager as Capsule;
session_start();
require __DIR__ . '/../vendor/autoload.php';
$app = new App;
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => 'localhost:8080',
'database' => 'payment',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();
require __DIR__ . '/../app/routes.php';
?>
I had also configured my php.ini
file properties like max_execution_time
& max_allowed_packets
but it didn't work and i had also checked that no loop is causing this problem because it takes approx 3 min to show me this error,in this 3 min the it loads.so please anyone can tell me where i'm doing in my code? 我还配置了我的
php.ini
文件属性,如max_execution_time
和max_allowed_packets
但它没有工作,我还检查了没有循环导致这个问题,因为它需要大约3分钟来显示这个错误,在这3分钟它loads.so请有人能告诉我我的代码在哪里吗?
Probably caused by your packets. 可能是由您的数据包引起的。 The following settings should help: Run this in your MySQL terminal.
以下设置应该有所帮助:在MySQL终端中运行它。
set global max_allowed_packet=104857600
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.