Web upgrade failed: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0"

I had to run through a lot of hoops but I finally got it to work after pressing every button. This all happened because I ran the update from inside the InvoiceNinja GUI which didn’t warn about needing PHP8.2x beforehand. When the installer completed, or perhaps failed?, it simply gave a generic error that PHP 8.2x was needed.

Basically:

  • Install the php-8.2 repository and install every php8.2-xxx library imaginable. “Digital Ocean + set up LAMP” has some excellent guides.
  • The php-fpm library for v8.2. must also be installed.
  • Purge all the old php8.1 or php7.4 libraries.
  • The install that I did for InvoiceNinja used NGINX instead of Apache.
  • Update the NGINX config file to reference the PHP8.2 binaries instead of 7.4x or 8.1x. Search the config files for the reference.
  • For some reason, a second entry section for a server under the same domain appeared in the NGINX config file. NGINX was set up to use different config files for each different domain (multi-site?). I had to comment out the second entry since it stopped NGINX from loading that domain, albeit NGINX was technically running.
  • Then the InvoiceNinja installer became active again and told me which other PHP libraries I needed to install. e.g. php-82gd (or something like that).
  • I got concerned so I backed up the invoice ninja database using MySQLDump > ninja.sql (that’s not the syntax)
  • Then, specified the existing DB username and password, localhost, the default MySQL Port (or MariaDB in this case), followed the GUI and eventually got where I could log in again. No data was lost.

I’m haven’t checked yet if InvoiveNinja’s docs have a self-hosted upgrade procedure but it would be great to avoid this lengthy downtime I experienced. Fortunately this is a PHP application so many of the usual techniques work for troubleshooting.