长连接配置

1、PHP

持久化连接

<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
    PDO::ATTR_PERSISTENT => true
));
?>

2、mysql

默认长连接

mysql > show global  variables like 'wait_timeout'

配置文件(my.cnf) wait_timeout
=28800 interactive_timeout=28800
原文地址:https://www.cnblogs.com/wuhg/p/11887750.html