L
L
lemonlimelike2017-08-29 23:41:02
css
lemonlimelike, 2017-08-29 23:41:02

What's wrong with openserver?

Here is the error PDO::__construct(): MySQL server has gone away
Points to the 4th line of this code

<?php

try {
    $pdo = new PDO('mysql:host=localhost;dbname=u571306', 'root', '', array(PDO::ATTR_PERSISTENT => true));
} catch (PDOException $ev) {
    print "Ошибка подключения к БД! <br>" . $ev->getMessage() . "<br>";
    die();
}

What is the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dima Pautov, 2019-05-08
@Tolly

https://codepen.io/bootd/pen/xNwVvV

N
NaN, 2019-05-08
@KornevaViktoria

Everything is here

D
DevMan, 2017-08-29
@lemonlimelike

just try

$pdo = new PDO('mysql:host=localhost;dbname=u571306', 'root', '');

and, while it's not related to the error, don't use print .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question