How To Migrate Invoice Ninja From One Hosting Server To Another

This tutorial will show you how to migrate your ninja invoice very easily from one hosting server to another with the assumptuion that you’ll be keeping the SAME url structure. This tutorial is still helpful even if you change URL’s.

In this example i’m going to migrate Invoice Ninja V4 from SiteGround to Cloudways. Please note, V4 does not work with PHP 7.4. You must use PHP 7.3. Invoice ninja V5 will be stable enough for PHP 7.4 when they officially release it.

At your current server

  1. Export your database using phphMyAdmin
  2. Download your entire invoice ninja directory files

On your new server

This tutorial utilizes Cloudways custom database as shown in the above video.

How to add an new php application to cloudways hosting

  1. (at Cloudways) Create a new custom php application. This will automatically create a new database for your invoice ninja.
  2. Launch Cloudways database manager (under access details)
  3. Import your database here. Keep note of the new database name, username and password. (How To Import a Database using phpMyAdmin)
  4. You are DONE with the database portion.
  5. NOW, Go to your website application (via FTP)
  6. Upload the unzipped ninja invoice file to the same path where it was located on your other server. For example: www.your-website.com/invoice-ninja

How to migrate invoice ninja from one hosting server to another - invoice ninja install new host cloudways

What’s makes Cloudways hosting awesome is that EACH of your applications on your server will be isolated from one another. This is a beautiful feature that you wont’ find at many hosting companies. An isolated application makes for a more secure application, more secure server and retains performance. If one website/application get’s hacked, it protects the other applications from getting hacked as well.

Yes, the limitation of one database per application and each application having its own public_html while on the same server is due to security purpose and we have made sure that every app on the server is isolated from each other and in case of one app gets compromised due to any faulty plugin or theme or code, it will not affect the other applications on the server. – Cloudways Support

So at SiteGround, being on a shared server, required that I use the same mysql database to load all my databases. All of my applications were also under public_html within their respective sub folders.

With Cloudways, I had to do this a little differently. My website and invoice ninja are in two different application installs.

Location of. Env file for invoice ninja

  1. Grab your new database details (user/pass/db name) from the custom application you installed earlier at cloudways.
  2. Use an FTP client. I like to use Nova FTP for my work. If you’re familiar with Coda, Nova is the new and improved version for Macs. I’m very happy with it.
  3. Connect to your Cloudways Server via FTP. The name of your database is also the name of your application folder in FTP.
  4. Locate the file path where you installed your invoice ninja files. In my case, it was with my WordPress install.
  5. Open up the .env file. Open the .env.example file (located in root)
  6. in the example env, you’ll notice the following fields listed below. This is the bare minimum you should have to change to get the system working properly in it’s new location. 
  7. What I did was disable the old .env file by renaming it .env.OFF. I then renamed .env.example to .env to make this the active .env file.
  8. Copy the APP keys from the old env to the new one.
  9. Replace the DB info , with the new database info you created at cloudways (found in the application’s access details)
  10.  Once you have confirmed the system is now working on the new server, you can continue to modify other important fields if you are using them (mail, cloudflare, payments, cron jobs, etc)

 

Minimum Fields To Change To Get System Working on New Server (.env file)
APP_URL= PUT IN URL (grab from original .env file)
APP_KEY= PUT IN KEY (grab from original .env file)

DB_TYPE=mysql
DB_STRICT=false
DB_HOST=localhost
DB_DATABASE=PUT IN DB NAME
DB_USERNAME=PUT IN DB USER
DB_PASSWORD=PUT IN DB PASS

Not on Cloudways yet? Check them out here.

Resources

The following are other resources that might help you in migrating your invoice ninja to a new server or deal with changing a new URL. There is also some instructions on how to upgrade to Invoice Ninja V5 if you would like to get a jump start.

Heather Valencia

Heather Valencia

Web Designer & Developer | Owner

I’ve been developing WordPress websites as a freelance web designer in Spokane since 2010. My passion for building websites is as strong as the dedication I put forth in strengthening my client relationships.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *