mysqli::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in

这个问题都是由于PHP版本过低+MYSQL版本过高引起的

MYSQL8.0 + 版本引入了新字符集 utf8mb4 

把老的utf8 alias至 utf8mb3

而老的PHP的MYSQLND模块没有包含新增的字符集

所以会出现

Error when using mysqli:

PHP Warning:  mysqli::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in ... on line 3

Error when using PDO_MYSQL:

Connection failed: SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers

解决办法很简单, 升级新的PHP版本即可

官方 https://bugs.php.net/bug.php?id=74461

有写的

[2018-05-02 12:13 UTC] [email protected]

Should be fixed as of 7.0.19, 7.1.5, and 7.2.0. Anyone confirm?

[2018-05-02 17:37 UTC] macleo at outlook dot com

Should be fixed as of 7.0.19, 7.1.5, and 7.2.0. Anyone confirm? - yes

所以7.0+的版本 基本都OK

One thought on “mysqli::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注