Command-line tips & troubleshooting

Other pages

Issues / errors

Ran into an issue where I couldn’t install anything due to the following error:

E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

Fixed it by doing the following

cd /var/lib/dpkg/updates
rm -rf *

A similar error to this is below:

[PACKAGE] needs to reinstall package but can't find the archive for it

This happens when an installation failed or was incomplete.

Fix it by running

sudo dpkg --remove --force-all

Upgrading PHP for WordPress

Since this blog runs on PHP, I had to upgrade PHP recently and after a bunch of googling I found the following in a digitalocean forum:

sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.4
sudo apt-get install php7.4-mysql
php -v (check to make sure PHP 7.4 is installed)
sudo apt install php7.4-fpm php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-mysql php7.4-cli php7.4-zip php7.4-curl
sudo a2dismod php7.0
sudo a2enmod php7.4
sudo service apache2 restart