wp: More headaches PHP 8.3 on DigitalOcean Ubuntu 22.04

OK, as I finally get the following configurations in order. Note that from previous experience, we need at least a 2GB RAM server to not constantly run out of memory

  1. tongfamily.com is an add-on domain to richtong.net on InMotion Hosting. Runs PHP 8.3 nicely (they have a nice way to update versions with Cpanel)
  2. richtong.org this is our newest site, it’s a fresh DigitalOcean build with their WordPress standard Ubuntu 22.04. The main thing is needs is the update to PHP 8.3.
  3. calvintong.com is the Cloudways DigitalOcean backed site. As I’ve documented pretty hard to manage and pretty slow to administer.
  4. richtong.com is our oldest site. It is stuck on Ubuntu 20.04 and I can’t upgrade it, but I did get it to PHP 8.3 with the magic of the andrej PPA repositories that let you port different versions of PHP. This is the one closest to retirement. It is not handling Cloudinary properly right now.

Upgrade 22.04 to PHP 8.3 for the system

How to make the PHP 8.3 work is a little complicated, first make sure it is up to date:

sudo apt update && sudo apt upgrade -y
# reboot if needed
[ -f /var/run/reboot-required ] && sudo reboot -f
sudo apt install curl gpg gnupg2 software-properties-common ca-certificates apt-transport-https lsb-release
# look for ondrej/php already installed
apt policy | grep ondrej/pph || sudo add-apt-repository ppa:ondrej/php
sudo apt -y install php8.3
# make sure the wp-cli is also installed

Upgrade Apache to PHP 8.3

Confusingly this only updates the system but WordPress doesn’t change because Apache has its own ideas about PHP version, so you need to install PHP for Apache

a2dismod php8.0
# make sure you have WP Server Stats to figure out the version
# Or look in /etc/apache2/mods.enabled
a2enmod php8.3
# now you need all the helpers
apt install php8.3-common php8.3-mysql php8.3-xml php8.3-xmlrpc php8.3-curl php8.3-gd php8.3-imagick php8.3-cli php8.3-dev php8.3-imap php8.3-mbstring php8.3-opcache php8.3-soap php8.3-zip php8.3-intl
systemctl restart apache2

Miscellaneous notes on restore Error Log Monitor for WP Server Stats needs wp-config.php change

When I did a restore this one thing didn’t work, I needed a log file and wp-config.php update in /var/www/html where WordPress lives find wp-config.php

//Enable error logging.
@ini_set('log_errors', 'On');
@ini_set('error_log', '/var/www/html/wp-content/elm-error-logs/php-errors.log');

//Don't show errors to site visitors.
@ini_set('display_errors', 'Off');
if ( !defined('WP_DEBUG_DISPLAY') ) {
	define('WP_DEBUG_DISPLAY', false);
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect

Recent posts

Loading Mastodon feed…