Upgrade Bookstacks to v23.02

Upgrade Bookstacks to v23.02
Photo by 🇸🇮 Janko Ferlič / Unsplash

So Bookstack has released version 23.02 and it has a breaking change of requiring PHP8. Very similar to Upgrade Monica to v4.0. So the first thing I do is check on what is currently running on BOOKSTACK-01.

  • php --version
PHP 7.4.33 (cli) (built: Nov  8 2022 11:40:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

So it looks like I can follow Bookstack Instructions for this. The first thing I do though is create a checkpoint in Windows Admin Center, just in case I break something, then I can revert. Next I'll log onto BOOKSTACK-01.
Steps performed on BOOKTSACK-01

  • sudo apt update
  • sudo apt install software-properties-common
  • sudo add-apt-repository ppa:ondrej/php
  • sudo apt update
  • sudo apt install -y php8.2 php8.2-curl php8.2-mbstring php8.2-ldap php8.2-xml php8.2-zip php8.2-gd php8.2-mysql libapache2-mod-php8.2
    • Unable to locate package php8.2

Well that isn't great. It must be due to Debian being a little more minimal and restrictive.

  • lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

So it looks like I'll need to modify Bookstack's steps a little.

  • sudo apt install apt-transport-https lsb-release ca-certificates wget -y
  • sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury/org/php/apt.gpg
  • sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
  • sudo apt update
  • sudo apt install php8.2 php8.2-cli php8.2-{bz2,curl,mbstring,intl}
  • sudo apt install -y php8.2 php8.2-curl php8.2-mbstring php8.2-ldap php8.2-xml php8.2-zip php8.2-gd php8.2-mysql libapache2-mod-php8.2
  • sudo a2dismod php7.2 php7.4 php7.3 php8.0 php8.1
  • sudo a2enmod php8.2
  • sudo systemctl restart apache2
  • php --version
PHP 8.2.3 (cli) (built: Feb 14 2023 16:53:07) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.3, Copyright (c), by Zend Technologies

Well there it is. The documentation mentions that I may need to update composer as well so let's go ahead and just do that.

  • composer -V
    • Composer version 2.3.5 2022-04-13 16:43:00
  • sudo composer self-update
    • Upgrading to version 2.5.4 (stable channel).
  • composer -V
    • Composer version 2.5.4 2023-02-15 13:10:06

Cool! Now I can move on to upgrading Bookstack itself.

  • sudo apt update
  • sudo apt upgrade -y
  • cd /var/www/bookstack
  • sudo git pull origin release
  • sudo composer install --no-dev
  • sudo php artisan migrate
  • sudo php artisan cache:clear
  • sudo php artisan config:clear
  • sudo php artisan view:clear

Going to check in a browser I receive the error:
Composer detected issues in your platform. Your Composer dependencies require a PHP version ">=8.0.2"

Well doesn't that just suck? So I ran into this same problem when I had to upgrade Upgrade Monica to v4.0. Checking on my notes from that. It looks like I ended up having to uninstall PHP completely, then reinstall 8 clean. Hopefully I don't have to do all of that here. Let's try this:

  • sudo apt purge php7.*

Well it is now coming up successfully in my browser. I'm pleased but a little surprised because I would have thought it would need to restart Apache after that to take the changes, but hey I'll take it!