I am using linux and tried to create some tables using php 7.2 but it will give an error as follows, when I execute command. Can anyone help me to fix this problem?
[PDOException] SQLSTATE[HY000] [2006] MySQL server has gone away
[ErrorException] PDO::__construct(): MySQL server has gone away
class Database extends PDO{
function __construct(){
$options = array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
try{
parent::__construct(DB_TYPE.':host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8',DB_USER,DB_PASS, $options);
}catch (PDOException $e) {
echo "Got PDOException\n";
var_dump($this);
}
}
}
I can not set the instructions for this page to the class I have https://dev.mysql.com/doc/refman/8.0/en/gone-away.html
$db->exec('SET session wait_timeout=60');