Upgrade Lead to 500 Server Error

Getting this error now that I’ve updated:
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:335

Stack trace:

#0 /var/www/html/ninja/app/Exceptions/Handler.php(79): Illuminate\Support\Facades\Facade::__callStatic()

#1 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(367): App\Exceptions\Handler->report()

#2 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException()

#3 /var/www/html/ninja/artisan(37): Illuminate\Foundation\Console\Kernel->handle()

#4 {main}

thrown in /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 335

Any ideas how to update?

Hi,

Which version of PHP are you using? The v5.5 version of the app requires PHP 8.1.

Just upgraded to PHP 8.1.8; I’m stick on version 5.5.8 (from version.php).

Also, receiving the following 500 server error in my logs (outside of InvoiceNinja):

Aug 7 20:46:00 invoice-ninja kernel: [ 5706.416609] [UFW BLOCK] IN=eth0 OUT= MAC=fa:45:f5:8a:29:03:fe:00:00:00:01:01:08:00 SRC=212.192.241.36 DST=134.122.5.252 LEN=48 TOS=0x00 PREC=0x00 TTL=113 ID=32740 PROTO=TCP SPT=10439 DPT=2205 WINDOW=65535 RES=0x00 SYN URGP=0
Aug 7 20:46:01 invoice-ninja CRON[6360]: (www-data) CMD (/usr/bin/php /var/www/html/ninja/artisan schedule:run)
Aug 7 20:46:01 invoice-ninja postfix/pickup[5580]: 70EB2BFE12: uid=33 from=

@david do you have any suggestions?

There is not enough information in the logs, i think the issue is you may have upgraded PHP to 8.1 for the CLI, but not enabled PHP 8.1 for the web user, you can test this by loading PHPinfo in your webbrowser to check which version the server is using there.

I can’t even get to that by posting phpinfo because the entire server is throwing the 500 server error.

PHP Fatal error: Uncaught Error: Class “Composer\InstalledVersions” not found in /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php:47

Stack trace:

#0 /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php(19): Jean85\PrettyVersions::checkProvidedPackages()

#1 /var/www/html/ninja/vendor/sentry/sentry/src/ClientBuilder.php(72): Jean85\PrettyVersions::getVersion()

#2 /var/www/html/ninja/vendor/sentry/sentry/src/ClientBuilder.php(80): Sentry\ClientBuilder->__construct()

#3 /var/www/html/ninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/ServiceProvider.php(163): Sentry\ClientBuilder::create()

#4 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Sentry\Laravel\ServiceProvider->Sentry\Laravel{closure}()

#5 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build()

#6 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(857): Illuminate\Container\Container->resolve()

#7 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve()

#8 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(842): Illuminate\Container\Container->make()

#9 /var/www/html/ninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/ServiceProvider.php(174): Illuminate\Foundation\Application->make()

#10 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Sentry\Laravel\ServiceProvider->Sentry\Laravel{closure}()

#11 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build()

#12 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(857): Illuminate\Container\Container->resolve()

#13 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve()

#14 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(842): Illuminate\Container\Container->make()

#15 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(119): Illuminate\Foundation\Application->make()

#16 /var/www/html/ninja/app/Exceptions/Handler.php(108): app()

#17 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(189): App\Exceptions\Handler->report()

#18 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(257): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()

#19 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure}()

#20 {main}

thrown in /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php on line 47

PHP Fatal error: Uncaught Error: Class “Composer\InstalledVersions” not found in /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php:47

Stack trace:

#0 /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php(19): Jean85\PrettyVersions::checkProvidedPackages()

#1 /var/www/html/ninja/vendor/sentry/sentry/src/ClientBuilder.php(72): Jean85\PrettyVersions::getVersion()

#2 /var/www/html/ninja/vendor/sentry/sentry/src/ClientBuilder.php(80): Sentry\ClientBuilder->__construct()

#3 /var/www/html/ninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/ServiceProvider.php(163): Sentry\ClientBuilder::create()

#4 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Sentry\Laravel\ServiceProvider->Sentry\Laravel{closure}()

#5 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build()

#6 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(857): Illuminate\Container\Container->resolve()

#7 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve()

#8 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(842): Illuminate\Container\Container->make()

#9 /var/www/html/ninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/ServiceProvider.php(174): Illuminate\Foundation\Application->make()

#10 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(871): Sentry\Laravel\ServiceProvider->Sentry\Laravel{closure}()

#11 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build()

#12 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(857): Illuminate\Container\Container->resolve()

#13 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve()

#14 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(842): Illuminate\Container\Container->make()

#15 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(119): Illuminate\Foundation\Application->make()

#16 /var/www/html/ninja/app/Exceptions/Handler.php(108): app()

#17 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(189): App\Exceptions\Handler->report()

#18 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(233): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()

#19 /var/www/html/ninja/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(257): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

#20 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure}()

#21 {main}

thrown in /var/www/html/ninja/vendor/jean85/pretty-package-versions/src/PrettyVersions.php on line 47

It looks like you may have an old version of composer from that error, can you advise the output of

composer -V

Also, if you put a file phpinfo.php

in the /public directory with the contents

<?php phpinfo(); ?>

And access it directly it should open… just make sure to delete it afterwards.

Composer Version: Composer version 2.3.10 2022-07-13 15:48:23

Dropped the php info to the public file and am now getting a 502 error (not 500) on the frontend. Still can’t see the file.

Attempted to reboot nginx (just to double check it wasn’t a config issue) and am getting this:

nginx.service - A high performance web server and a reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: failed (Result: exit-code) since Sun 2022-08-07 21:49:35 UTC; 14s ago

Docs: man:nginx(8)

Process: 2260 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Process: 2273 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Aug 07 21:49:33 invoice-ninja nginx[2273]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Aug 07 21:49:33 invoice-ninja nginx[2273]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Aug 07 21:49:34 invoice-ninja nginx[2273]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Aug 07 21:49:34 invoice-ninja nginx[2273]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Aug 07 21:49:34 invoice-ninja nginx[2273]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Aug 07 21:49:34 invoice-ninja nginx[2273]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Aug 07 21:49:35 invoice-ninja nginx[2273]: nginx: [emerg] still could not bind()

Aug 07 21:49:35 invoice-ninja systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE

Aug 07 21:49:35 invoice-ninja systemd[1]: nginx.service: Failed with result ‘exit-code’.

Aug 07 21:49:35 invoice-ninja systemd[1]: Failed to start A high performance web server and a reverse proxy server.

We see this when apache is also installed and was the first to connect to port 80. that would be where i would look.

also ensure in your nginx conf for invoiceninja that you have updated the FPM module to point to 8.1

Double checked, and confirmed Apache was running; disabled that from accidentally happening. Relaunching nginx now with the config with the latest config from the docs:

https://invoiceninja.github.io/docs/self-host-installation/

Specifically this:
fastcgi_pass unix:/run/php/php8.1-fpm.sock;

Still getting a 502 error.

Also, adding:

include fastcgi.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock

Results in nginx failing the test with:

nginx: [emerg] “fastcgi_pass” directive is duplicate in /etc/nginx/sites-enabled/billing:30
nginx: configuration file /etc/nginx/nginx.conf test failed

Was able to confirm that there was a mismatch in the config file. Was able to load phpinfo on the frontend, version:

PHP Version 8.1.8