Database connection error after running apt dist-upgrade

I’m not sure that this is the right forum for this question, but it’s part of a bigger hurdle I’ve been working through - trying to update the PHP version of my wordpress site that using bedrock/trellis - and I’ve received such great help and pointers on the other questions I’ve posted here so I’ll give it a shot. Let me know if I should take my question elsewhere.

So, I messed up somewhere, but I’m not sure where. The website is unresponsive, with a " Error establishing a database connection" error on frontend and admin. The website seems to have stopped working after I ran apt dist-upgrade on the server, but keep in mind that this is on the heels of updating trellis. My original intent was to update PHP from 7.1 to 7.4, (which I have successfully done on my local site), but at what cost :persevere: PHP is not updated on the server.

I checked all the error logs, and don’t see anything that really pops out. Is there any way to get more information here?

Ubuntu 16.04
Wordpress 5.8
anisble 2.9

Does anyone have any sort of idea on this? Totally lost here - if you’re reading this, let me know where /you / would start! Even if it seems obvious… If anything I’m asking could be made more clear, let me know.

If I was in this situation I would probably spin up a new server, provision it with Trellis, make sure it works, then move DB and content over from the broken server and change DNS. Part of the idea of a system like Roots is to make individual servers fairly disposable: so long as you can get the unmanaged parts (images and DB) you can spin up a brand new server pretty quick.

1 Like

That’s fair. I worry though that when I make the next deployment to production, the live site will shut down the same way staging did. I’m just trying to get to the root of it for my piece of mind. But burning it down and starting again isn’t out of the question at this point…

Have you also updated the composer file in bedrock recently?

Updating phpdotenv and not making changes to these lines has caused a few sites to show db connection errors, I think we’ve forgotten to do this on 3 sites so far and each time had a moment of head scratching.

Also check the actual error log - what is the exact reason for the database connection failing?
And have you not only updated PHP-FPM but also its PHP extension packages to the same versions?

This topic was automatically closed after 42 days. New replies are no longer allowed.