Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SPnKM's avatar
Level 1

Sudden database issues

I had a Laravel 7 project running on PHP 7.4, and 2 days ago it suddenly started pushing out database related errors, first loads of SQLSTATE[28000] [1045] Access denied for user and later on some SQLSTATE[42S02]: Base table or view not found , and after that SQLSTATE[23000]: Integrity constraint violation: 1452 errors with foreign keys. Eventually it started just returning 503 when I was tried to access any url. For some reason 503 dissapears if I raise opcache limit.

I made no updates or changes when this issue started. Hosting said they updated MariaDB to 11.2.3 the same day, and that there could have been also automatic updates on some php libraries.

It stopped returning those DB connection related errors by itself, yet nothing still worked, couldn't use any logins or other functionalities, it seemed like it didn't find anything from the DB (hosting double-checked that database is healthy and working fine though).

So, since I was on L7 and (too) old PHP, I upgraded the project first to L8 and finally to L9 & PHP 8.2, yet the same issue is still there. However, I noticed now that I actually do get data from database, but it's structured and encoded(?) wrong:

If I have this in users table:

id: 1
uuid: cf7d124e-d1be-4412-a7af-40123412b8bc
active_company: 27
name: John
lastname: Rambo
date_of_birth: 1980-10-10
valid_to: NULL
address: NULL
postal: NULL
city: NULL
phone_prefix: 1
phone: 408787878
email: [email protected]
...

dd(User::first()); returns:

id: "\x00"
uuid: ""
active_company: ""
name: ""
lastname: ""
date_of_birth: ""
valid_to: NULL
address: NULL
postal: NULL
city: NULL
phone_prefix: ""
phone: "cf7d124e-d1be-4412-a7af-40123412b8bc"
email: b"\x00\x00\x00\x00\x00\x00\x00\x04John\x07Rambo\x04À\x07\f\x0F\x01\x00"

According to logs, this behaviour started before my Laravel upgrades. Any ideas what could cause this?

0 likes
3 replies
jlrdw's avatar

Did yo:

  • follow the update paths in the documentation
  • read the various changes in php versions in their wiki of changes
  • check the maria db documentation for any changes
  • etc

Remember laravel has to be manually updated prior to a framework upgrade.

1 like
SPnKM's avatar
SPnKM
OP
Best Answer
Level 1

Huh, finally solved. Apparently pdo_mysql version caused this, swapping to nd_pdo_mysql fixed everything! I don't want to even know how many new gray hairs I got during these couple of days..

Please or to participate in this conversation.