7

Suddenly I got this error in my Laravel web application.

PDOException in MySqlConnector.php line 38:

SQLSTATE[HY000]: General error: 1835 Malformed communication packet

Can you help me out to solve this?

Smuuf
  • 6,339
  • 3
  • 23
  • 35
Thilak Raman
  • 79
  • 1
  • 4
  • Could you please add the query / statement / code that causes this error? – piscator Nov 04 '20 at 09:25
  • Maybe add some details about versions of your stack. – Repox Nov 04 '20 at 09:38
  • Happened to two of our apps today, too. It seems that is happened after upgrading `MariaDB-server-10.2.31-1.el7.centos.x86_64` -> `MariaDB-server-10.2.35-1.el7.centos.x86_64`. Might there be some similarity? – Smuuf Nov 04 '20 at 10:58
  • I have the same problem this morning I think it's because of auto-update that happened in MariaDB or maybe centos 6 was upgraded to centos 7 because CentOS-6 will reach End of Life on November 30th, 2020. End of Life means a product is no longer supported – aitbella Nov 04 '20 at 11:12
  • 2
    Experienced the same issue. Found an answer from here -> https://stackoverflow.com/questions/64677836/sqlstatehy000-general-error-1835-malformed-communication-packet-on-laravel – desiree Nov 04 '20 at 11:39
  • Same on Ubuntu mate for mariadb-server-10.4.16 (version 1:10.4.16+maria~focal). I downgraded to 10.4.15 – Collector Nov 04 '20 at 13:33
  • @Collector is it working after downgrading the version? – Thilak Raman Nov 04 '20 at 13:59
  • @ThilakRaman it works. Stop the service `systemctl stop mariadb`, `apt remove mariadb-server` and all other installed packeages mariadb*, install old version `sudo apt install mariadb-server=1:10.4.15+maria~focal` and all other related packages with =version add to end, you must specify all packages mannualy. Test it with `sudo apt install -s mariadb-server=1:10.4.15+maria~focal` to see if version are ok on other depended packages. – Collector Nov 04 '20 at 14:13

1 Answers1

0

With reference to another post, I have added the below line in db connection and its working for now.

'options' => [PDO::ATTR_EMULATE_PREPARES => true]

Thilak Raman
  • 79
  • 1
  • 4
  • This is not a solution, nor an explanation, it's rather a workaround with implications not mentioned in your answer. – Daniel W. Nov 04 '20 at 13:35
  • @DanielW. Is there any permanent solution for this issue? Please suggest. – Thilak Raman Nov 04 '20 at 13:59
  • Have you tried upgrading the client driver to the same version as the server ugpraded to? Can you share your client and server versions please – Daniel W. Nov 04 '20 at 14:23
  • I did that but in my laravel, although the above error went away, it started causing errors in some other PDO queries. so this line in config only caused other unknown problems. – Neel Nov 05 '20 at 06:12