Migration from One Server to Another, Explanation

HI, I am manually migrating from one server to another. Not too difficult.
Download database and files from old server, upload to new server.
However, the new server is going to have some different variables, such as database name, username and password. Easy right? Just change the .env file with the new information. Considering, my domain and file path all remain exactly the same.

However, I discovered, that can’t possibly be the only changes Because something isn’t working. I noticed all these fields that possibly need new paths and data. Is this accurate?

  • PHPRC=
  • PHPHANDLER=
  • HTTP_HOST=
  • HTTP_X_REAL_IP=
  • SERVER_ADDR=
  • SERVER_PORT=
  • REMOTE_ADDR=
  • DOCUMENT_ROOT=
  • SCRIPT_FILENAME=
  • REMOTE_PORT=
  • DB_HOST=
  • DB_DATABASE=
  • DB_USERNAME=
  • DB_PASSWORD=

Would I need to change all these fields too? And some of that information is hard to find, like remote port? remote address? are those necessary for me to access my program on a computer? What can I safely delete(optional)? What exactly needs changed?

I found all these old articles, but nothing that really covered exactly what should be changed in the file.

Is it possible to regenerate this content for the new server without compromising the current database? I assume .env must be created at setup since I couldnt’ find that file in a fresh download of invoice ninja.

Here is a picture of my current error, which I’m certain has something to do with the .env file not being populated with the correct content. https://imgur.com/LvjFmiF

Hi,

Many of those values aren’t needed.

I think the error may be a permission issue, I suggest checking the web server can write to the log files.

So which ones would you say are absolutly needed when switching servers just to make sure the software works and displays?

I suggest copying over the entire .env value and just changing the APP_URL value

Well, the APP_URL actually doesn’t need to be changed because I’m not changing the URL at all. Just moving from one server to another. The only thing on the surface I can see that should be changed is the database info which is easy to change. However, like stated above, there are other IP’s and addresses involved I’m not sure about. What’s the minimul amount of code in .ENV that’s needed to make it work?

I checked my file permissions and I"m using 755 on the root folder. That laravel folder i set to 777 and then a new error just appeared. which is why I believe it’s just a connection error because of my incorrect settings.

New error when changing Unparenthesized a ? b : c ?: d is deprecated. Use either (a ? b : c) ?: d or a ? b : (c ?: d)

That error usually means you’re using PHP 7.4, try changing to 7.2 or 7.3

AH! Thats exactly what is was. It seems to be working now. I wasn’t aware that it wasn’t stable for PHP 7.4. When will that change?

I have to change my entire server and all my other applications to run on 7.3 because of Invoice Ninja. Not a huge deal, but like to be as up to date as possible so my sites run on the best of the best so I can utilize the most of my performance and security features as I can.

Awesome, glad to hear it!

v5 supports PHP v7.4, we don’t plan to support it with v4 though.

oh, so where do I download version 5? I don’t see it here on the main site and I don’t see update options inside my panel anywhere. Unless I just don’t know where to look?

It’s still in beta but there’s more info here:

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

That link gave me a 404 error. Is this what you’re talking about?
Here is the proper link for those who find this thread. https://invoiceninja.github.io/docs/migration/
https://www.invoiceninja.com/v5-sneak-peek/

Thank you for your help. I need to upgrade as using the latest php is more important for my needs right now.

Sorry, yes… that’s the correct link

I made this tutorial at my website because this was the most frustrating thing not being able to find a proper tutorial anywhere. For anyone else who needs it. It’s pretty simple: https://ravenousravendesign.com/software/how-to-migrate-invoice-ninja-from-one-server-to-another/

Sorry if this is not allowed, just let me know and I’ll delete.

4 Likes

That’s awesome, thanks for writing the post!!