Upgrade from v4.5.19 to v4.5.20 breaks site (self-hosted)


Got an alert from cPanel dashboard to update Invoice Ninja v4.5.19 to v4.5.20 today, upon upgrading via Softaculous I got an error saying:

The following errors were found:

  • Required PHP extension not found: fileinfo
    Screenshot 2020-11-03 124933

So I enabled fileinfo via PHP version 7.4

Re-started the upgrade and it finished but only to find the upgrade broke the site, I got the following:

I tried overwriting the files manually via FTP but it was still broke.

Luckily I was able to roll back to my older version via backup on my server, I’m now back to v4.5.19 and all is working again.

Any help is much appreciated.



Are there any related errors in storage/logs/laravel-error.log

Hi Hillel,

Thanks for your response.

Because I rolled back to a server back-up it’s now working again on v4.5.19 there would be no upgrade error in laravel-error.log unless I repeat the upgrade again.

I might setup a staging version to try out the upgrade again.

On another note would upgrading to V5 be the better option? I looked at the documentation and when clicking on Start Migration the next step is also broken for me, I have Invoice Ninga installed in a sub directory like:


Clicking on Start Migration wants to take me to mydomain.com/migration/start which is a bad url.

To upgrade from v4 you need to install v5 as a separate app but you’ll want to first upgrade your instance to 4.5.20

OK Hillel I will try again, I’ll keep you posted here on how that it progresses.



Hi @hillel,

I setup a staging site and tried the upgrade again, here’s what happened.

On the staging site there was the option to upgrade to v4.5.21 so I proceeded. Upon upgrade I got the same error message:

Had a look at storage/logs/laravel-error.log which revealed the following:

[2020-11-08 12:20:54] production.ERROR: ***ErrorException*** [0] : /home/root/public_html/invoiceninja/app/Models/Account.php [Line 1126] => Unparenthesizeda ? b : c ?: dis deprecated. Use either(a ? b : c) ?: dora ? b : (c ?: d) {"context":"PHP","user_id":1,"account_id":"1","user_name":"","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36","locale":"en","ip":"","count":4,"is_console":"no","is_api":"no","db_server":"mysql","url":"/"} []

Through trial and error I managed to fix the issue at line 1126 by putting parenthesis around this:


       $currencyId = ($client && $client->currency_id) ? $client->currency_id : ($this->currency_id) ?: DEFAULT_CURRENCY;
    $locale = ($client && $client->language_id) ? $client->language->locale : ($this->language_id ? $this->Language->locale : DEFAULT_LOCALE);

The staging site is now running on v4.5.21 with the above fix.

Where can I get V5 and is there any documentation on upgrading?




Please check you aren’t using PHP 7.4, only up to 7.3 is supported with v4.x

Hi @hillel, That sorted out the issues. I am running PHP 7.4 accross the server but added this to Invoice Ninja .htaccess file to run independently at PHP 7.3

# Use PHP73 as default AddHandler application/x-httpd-php73 .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/php73/lib </IfModule>

Now running version v4.5.21

1 Like

Hi @hillel,

I’ve been upgrading v4 versions and currently at v4.5.42 using the same hack in .htaccess

# Use PHP73 as default AddHandler application/x-httpd-php73 .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/php73/lib </IfModule>

I’ve noticed recurring invoices aren’t getting sent, is it a cron issue? any insight into this please?

I’m delaying upgrading to V5 as I’ve had a few failed attempts.



A common problem is the PHP CLI using 7.4, you can run php -v to check

Thanks for the quick reply. I have access to Putty SSH can I run the command there?

Yes, that is correct

1 Like

This is the response back from running the command php -v

PHP 7.4.20 (cli) (built: Jun 2 2021 07:30:30) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies

Any further tips/help to overcome my issue?


That would explain the problem, you need to change the CLI version to 7.3 (or upgrade to v5).

1 Like

Thanks I will weigh up my options.

Hi @hillel I’ve finally managed to upgrade to V5, it’s blazingly fast comapred to V4, thanks.

I’m a bit stuck on the cron job, from the dashboard I’m getting “The crons need to be enabled” I’m using cPanel to add/edit cron jobs. After V5 installation I checked and the following command was added:

cd /home/m564305/public_html/invoice && /opt/alt/php74/usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

Bear in mind the status of the company is “Company is not activated” should this be active for cron to run?

Any advice?



Awesome, glad to hear it :slight_smile:

What do you see if you run the cron from the command line

Note: you’ll want to remove “>> /dev/null 2>&1” to see the error

Sorry but unfortunately things have taken a dip, my V5 installation has gone down, it’s just a blank page now. I’ve enabled APP_DEBUG=true in the .env file. Don’t know what to do from here.

This is what returns from command line:

The environment file is invalid!
Failed to parse dotenv file. Encountered unexpected whitespace at [Name :: User].

Do you have an unecnlosed white space in the .env file

ie. VALUE=some word

It would need to be:

VALUE=“some word”