This question already has an answer here:
- PDO: MySQL server has gone away 8 answers
my connection php:
class ConnexionBDD{
public function getConnexion(){
try {
$cnx= new PDO("mysql:host=localhost;dbname=portfolio",
"root",
"",
[
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES 'UTF8'',
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
]);
}
catch (Exception $e){
die("Erreur de connexion à la base de donnée : ". $e->getMessage());
}
return $cnx;
}
}
Error code :
Warning: PDO::__construct(): MySQL server has gone away in C:webPortfolioV_3.5controleurConnexionBDD.php on line 15
Warning: PDO::__construct(): Error while reading greeting packet. PID=6980 in C:webPortfolioV_3.5controleurConnexionBDD.php on line 15
Warning: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in C:webPortfolioV_3.5controleurConnexionBDD.php:15 Stack trace: #0 C:webPortfolioV_3.5controleurConnexionBDD.php(15): PDO->__construct('mysql:host=loca...', 'root', '', Array) #1 C:webPortfolioV_3.5controleurinsertionBDD.php(10): ConnexionBDD->getConnexion() #2 C:webPortfolioV_3.5controleurContactController.php(15): insertionBDD->createClient('coudoumie', 'morgan', '', '') #3 C:webPortfolioV_3.5index.php(35): ContactController->Contact() #4 {main} thrown in C:webPortfolioV_3.5controleurConnexionBDD.php on line 15
Fatal error: Maximum execution time of 30 seconds exceeded in C:webPortfolioV_3.5controleurConnexionBDD.php on line 15
Aucun commentaire:
Enregistrer un commentaire