phpmariadbmysqlnd

Mariadb 11.3.2 + PHP: Server sent charset (0) unknown to the client. Please, report to the developers


If you try to connect with PHP PDO to the newest Version of mariadb (11.3.2) you will see this error and the client will be unable to connect:

SQLSTATE[HY000] [2054] Server sent charset (0) unknown to the client. Please, report to the developers


Solution

  • Reason: Mariadb sends a value that was unset before. While this is perfectly inline with the protocol since 2004, the mysql driver of php still implements a status of the protocol of this value as before of 2004, and thus will crash.

    You need to unset collation-server and character-set-server or set it to a compatible value in the server config until this is fixed.

    MariaDB Docker Image: Just add

    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
    

    Normal Install:
    Just remove the line character-set-collations = utf8mb4=uca1400_ai_ci from /etc/mysql/mariadb.conf.d/50-server.cnf

    More Info: https://github.com/php/php-src/issues/13452