I am trying to connect to my db on my synology in PHP. I use the following code to do so :
try {
$db = new PDO("mysql:host=192.168.1.45:3307;dbname=mydbname;charset=UTF8",$username, $pass);
} catch (Exception $e) {
echo $e->getMessage();
}
The problem is that when I'm trying my code it tell me : SQLSTATE[HY000] [2006] MySQL server has gone away. Packets out of order. Expected 0 received 1. Packet size=71
I looked on some site and made the following change on my "my.cnf" file in mariaDB10 :
[mysqld]
max_allowed_packet = 256M
[mysqld]
wait_timeout = 28800
[mysqld]
interactive_timeout = 28800
My PHP version on my synology is set to 7.2.
I changed the pdo_mysql.default_socket to : /run/mysqld/mysqld10.sock
I don't find any clue on how to solve my problem. Can you please help me with this?
Thanks in advance,
Aucun commentaire:
Enregistrer un commentaire