I Almost Completely Broke My Site

Disclaimer: this might veer too far into computer nerd territory. But, I’m very relieved to have fixed the issue without having to restore a 6-day-old backup and possibly losing a post or two and theme/plug-in changes. So, here’s what happened…


I use WordPress to run my blog. I’m not proud of it, but it’s simple to use, set up, and find support for. In theory. Anyway, the version of PHP I had installed on my Digital Ocean droplet was out-of-date, and WordPress wasn’t happy about this. So I thought, “okay, no big deal.” After all, I’m a software engineer and I update software and software dependencies all the time. However, I am not a WordPress/PHP developer, and I have limited experience in managing a Linux system.

Anyway, I look for some instructions that I hope I can copy and paste into the command line and upgrade in no time. Technically, that’s true. I did find these instructions that got me most of what I needed. However, these instructions are specific to nginx and I’m using apache2. There was a key instruction missing, and that was this: sudo apt install libapache2-mod-php7.4. However, I wouldn’t discover that until days later (tonight).

I checked the installed version of PHP, and it told me that 7.4.9 was installed, so everything should have been good right? However, in the WordPress dashboard, it said the version was still out-of-date. I rebooted the machine, same thing. I didn’t have time to worry about it, so I left it like that and didn’t worry about it until today, when I finally had time to look into it deeper.

Well, I tried to find all the places where the config could be wrong, which was challenging since I don’t know where those places are. I installed something to edit the .htaccess file from within WordPress. No luck there. I looked through the instructions again. I searched on DuckDuckGo (fuck Google). Nothing useful.

So, I thought, “welp, I’ll just uninstall all the old versions of PHP!” What could go wrong? Did I take a backup of my site just in case? Of course, I didn’t! Just a reminder, always take the fucking backup. So, what happened when I uninstalled PHP 7? My site ceased to function: 500 internal server error responses. Well, shit. That can’t be right. I’ll reboot the machine! Womp, womp. No use. Well, I’ll uninstall all of the versions of PHP and install 7.4 again! This is how that went…

via GIPHY

So installed PHP 7 again. The site was no longer broken but still showed the same warning in the dashboard as before. This time, I took the fucking backup (technically a snapshot). After going through the instructions several times over and over again, I noticed a message being output when installing PHP 7.4: You’re seeing this message because you’re using apache2. Or something like that. Basically, it was telling me that I had to manually update some modules and configs using a2enmod and a2enconf respectively for the damn thing to work with apache.

via GIPHY

However, whenever I got to the place in the instructions that said to enable the php7.4 module, it would fail. It’s done that every time I’ve tried it. For some reason, I didn’t think it was a big deal. I’m an idiot. Anyway, after some DuckDuckGoing, I found the aforementioned command that solved all my woes and allowed me to be running on the latest and greatest:

sudo apt install libapache2-mod-php7.4

The lesson here is to 1) take backups before doing anything like this, especially when you don’t know what the fuck you’re doing; 2) read all of the output and error messages; and 3) maybe don’t manage this yourself. I’ve thought about #3, but I think I’ll continue the trend I have since my hosting is literally $6 a month, including backups. Let me know in the comments if you’ve ever done something so willfully stupid and ignorant as I just described. TAKE BACKUPS!

Leave a Reply

Your email address will not be published. Required fields are marked *