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

I was given an option in the web GUI to update to the latest version. It gave me the error:

Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.2.0”.

So I’ve tried to upgrade to the last version of PHP via CLI using this: How to install/upgrade PHP 8.2 on Debian and Ubuntu systems • PHP.Watch

But i’m still getting the error regarding composer dependencies when I try to access the InvoiceNinja URL. Nothing works at this point.

In the CLI, php -v shows PHP 8.2.20 (cli) (built: Jun 8 2024 21:37:34) (NTS)


Also, looks like nginx is running PHP 8.2:
sudo update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

Selection Path Priority Status

  • 0 /usr/bin/php8.2 82 auto mode
    1 /usr/bin/php8.1 81 manual mode
    2 /usr/bin/php8.2 82 manual mode

Press to keep the current choice[*], or type selection number:

Hi,

It may help to setup a phpinfo page to confirm the PHP web settings.

If there’s an option to disable older php versions it may help.

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.

Glad to hear it’s working now, thanks for sharing the solution!

For future reference… we increase the version number if there’s a big change in the app (ie. 5.8.x to 5.9.x) and then add details in the release notes.