Suddenly got
SQLSTATE[HY000]: General error: 1835 Malformed communication packet (SQL: select * from
tb_users
where (username
=
After many workarounds i tried today this the solutions i got
1- upgrade to php 7.3 or 7.4
(many websites will be down after php upgrades )
2- downgrade to minor version ( mariadb 10.4.16 to 10.4.15)
yum downgrade MariaDB-server MariaDB-common MariaDB-shared MariaDB-client MariaDB-compat MariaDB-devel
anyway this problem is opened case as bug for Mariadb last night update and they didnt push any fixing for now the above solution is only the 2 ways to solve the problem , it works with me on mariadb downgrade from 10.4.16 to 10.4.15 (minor downgrade)
Updated php version**(7.2 to 7.3)** inside cpanel for my subdomain.
Must give all the previlege to the selected database user.
It worked for me.
An emergency Release of MariaDB 10.5.8, 10.4.17, 10.3.27, and 10.2.36 is now available that was released to specifically solve this protocol incompatibility in old PHP versions and PDO.
Found the solution. Don't know if it's permanent or temporary:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
**'options' => [PDO::ATTR_EMULATE_PREPARES => true]**
],
make sure that
'options' => [PDO::ATTR_EMULATE_PREPARES => true]
exist on mysql connection.
Also ran into this issue after mariadb updated overnight. Downgrading mariadb fixed the issue for me.
https://support.cpanel.net/hc/en-us/articles/360056772334
What worked for me was to upgrade PHP version on the subdomain from 7.2 to 7.3. I did not change anything in the database configuration as has been suggested in some answers.