Страница 1 из 1

MySQL 8.0 и PHP 5.3

Добавлено: 15 сен 2023, 17:49
eandr-67
Существует ли способ решения проблемы без перехода на более свежую версию PHP?

Установлен OpenServer 5,3,8.
Интерпретатор PHP 5.3.29 (cli)
Выполняемый код:
<?php

$db1 = mysql_connect('localhost', 'root', 'root');
mysql_select_db('demo');

$db2 = new mysqli('localhost', 'root', 'root', 'demo');

$db3 = new PDO('mysql:dbname=demo;host=localhost', 'root', 'root');
При попытке подключиться к MySQL 8.0 выскакивают сообщения об ошибках:
Warning: mysql_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 3

Warning: mysql_connect(): Server sent charset unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 3

Warning: mysql_select_db(): Server sent charset (255) unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 4

Warning: mysql_select_db(): Server sent charset unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 4

Warning: mysql_select_db(): A link to the server could not be established in D:\OpenServer\domains\test.tst\test2.tst.php on line 4

Warning: mysqli::mysqli(): Server sent charset (255) unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 6

Warning: mysqli::mysqli(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 6

Warning: PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in D:\OpenServer\domains\test.tst\test2.tst.php on line 8

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers' in D:\OpenServer\domains\test.tst\test2.tst.php:8
Stack trace:
#0 D:\OpenServer\domains\test.tst\test2.tst.php(8): PDO->__construct('mysql:dbname=de...', 'root', 'root')
#1 {main}
thrown in D:\OpenServer\domains\test.tst\test2.tst.php on line 8

Re: MySQL 8.0 и PHP 5.3

Добавлено: 02 окт 2023, 18:40
SagePointer
В конфиге MySQL указать устаревшие кодировки:
character_set_server    = utf8mb3
collation_server        = utf8mb3_general_ci