Error when Installing on Ubuntu 22.04


I am trying to (finally) migrate to v5 having used v4 for a while. I have a reasonably fresh 22.04 VM, I am downloading the latest zip file from the GitHub releases and when accessing the site (with nginx and php-fpm 8.1) or running php8.1 artisan optimize I get the following errror:

# php8.1 artisan optimize

PHP Fatal error:  During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1277
Stack trace:
#0 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Support/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /srv/www/sites/invoiceninja5/vendor/composer/ClassLoader.php(444): include('...')
#2 /srv/www/sites/invoiceninja5/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#3 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Support/helpers.php(109): Composer\Autoload\ClassLoader->loadClass()
#4 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): collect()
#5 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()
#6 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
#7 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(219): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()
#8 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(320): Illuminate\Foundation\Application->bootstrapWith()
#9 /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 /srv/www/sites/invoiceninja5/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#11 {main} in /srv/www/sites/invoiceninja5/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 11

What am I missing?



@david do you have any thoughts?

1 Like

My searching around leads to the opinion that it’s a php8 support issue, but it should work fine with php8 correct?

Correct, the app supports PHP 8.1

1 Like

Just to clarify, you need PHP 8.1, the app will not work on PHP 8.0

The error above indicates that the system is still using PHP 8.0

1 Like

Thanks a lot for the help!

I think that 22.04 comes with php 8.1 certainly this indicates I am running php 8.1:

# php --version
PHP 8.1.2-1ubuntu2.8 (cli) (built: Nov  2 2022 13:35:25) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.8, Copyright (c), by Zend Technologies

I checked the fpm services as well and that should be using 8.1


One thing to note is that the CLI version and FPM version can differ.

You may want to load up a phpinfo() page to see which php version the web server is loading.

I loaded a php info page and that also shows 8.1:


Could you try running from the command line.

composer i -o --no-dev


php artisan optimize

I think I found the issue, but it’s somewhat confusing.

The script I was running (from ages ago) wasn’t downloading from GitHub releases as I thought it was it was downloading from{version} why are the zip files there different?

Thanks everyone for your help!

That location only contains the v4 version, in v5 we host the zips on GitHub

1 Like

Ok I suspected that might be the case, it is weird that it downloads a zip file for a v5 version number then?

I’m not sure, which specific URL are you loading?

I was downloading which seems to redirect to which was what was confusing me.

1 Like