How to Update v4 to v5 on selfhosting

I’m using v4.5.34 on selfhosed webserver (without sudo).
How it will be possible for upgrade to v5.1.32?

When I only change the folder with copy “.env” it don’t work.
Can you please send me a step-by-step information to upgrade.


Are there any errors in the web server error logs or the application logs in storage/logs/

Which version of PHP are you using? The latest v4 versions support PHP 7.1, 7.2 and 7.3.

PHP is running with 7.3 and there will be “error 500” by login:

production.ERROR: Trying to get property 'id' of non-object {"userId":1,"exception":"[object] (ErrorException(code: 0): Trying to get property 'id' of non-object at /html/ninja-4-5-34-DEV/app/Models/User.php:162)

I found “Start Migration” under account management, but this also don’t work:
Cross account migration is not allowed. Please read more about it here:
But this link also don’t work (error 404):

I use multiple accounts. Is this no longer possible with v5 and is that the problem?

To upgrade from v4 you need to install v5 as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management.

v4 supported up to 5 companies, v5 supports up to 10.

Note: the latest v4 version is v4.5.35.

So you can not update the existing application but must migrate to a new one?
So the URL also changes?

Do I understand it correctly:

  1. update v4.5.34 to v4.5.35
  2. installation v5.1.32
  3. migration v4.5.35 → v5.1.32
  4. change domain to v5.1.32

That is correct

v5 is a complete rewrite from scratch, we’ve tried to keep the database as similar as possible but it wouldn’t be possible to update as the system requirements are different.

But it don’t work!
I get the following error by migration to new site:

production.ERROR: ***ErrorException*** [0] : /html/ninja-4-5-35-DEV/app/Http/Controllers/Migration/StepsController.php [Line 262] => ZipArchive::close(): Failure to create temporary file: No such file or directory {"context":"PHP","user_id":1,"account_id":1,"user_name":"XXX","method":"POST","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0","locale":"de","ip":"","count":3,"is_console":"no","is_api":"no","db_server":"mysql","url":"migration/companies
"} []

Maye this will help?

OK, the folder “migrations” was missing. Now the migration seems to run. I am curious.

Witch crons I need?

On v4 I was using the following two crons:
php artisan ninja:send-invoices
php artisan ninja:send-reminders

But in v5 these no longer exist. Therefore the question, which crons must run?

There’s info about the v5 crons here:

I would really like to keep working with Invoice Ninja, but the migration is not fun because it doesn’t work.
A zip file is created but not imported.

How can the data now be imported in the new version?

Have you seen the info here:

I give it up and will work so long it will be possible with v4.

  • directories are read/writable
  • table " jobs" is empty
  • There is no entry in “laravel.log”
  • Error: “400: Die “White-Label”-Lizenz ist nicht gültig”
  • “EXPANDED_LOGGING=true” is set

If I found time I’l looking for a other system or put all data manual in v5.
In the moment I’ve no fun with v5, so I will delete it.
Anyway, thanks for trying and have another good time.

@david any ideas?

FYI… we’ll be release new v4/v5 versions soon with more fixes to the migration.

That still raises some hope. Until when are these available?

Should be in a few days


When you attempt a migration, are there any error messages in your V5 installation in storage/logs/laravel.log ?