Setup Invoice Ninja on HostGator (Shared)

Introduction

This document is created to help persons setting up InvoiceNinja on HostGator Shared Hosting accounts. While the instructions may be specific to HostGator the principles may apply to other hosts.

Requirements
  • HostGator account or other hosting account / website.
  • FTP access to site.
  • SQL database and user creation.
  • PHP 7.0 or higher.
  • InvoiceNinja 4.5.5 (as of this writing) – extracted ZIP.
  • FTP client.
Disclaimer

I’m doing this entirely voluntarily. If you mess something up I will not be held responsible. This is to help persons with HostGator Shared Hosting accounts – if you’re hosted elsewhere then the principles may apply but the steps may be different.

Please be aware that during tests it was found that uploading and extracting the ZIP from the host file manager failed. There seems to be a permissions issue which is why the longer route of uploading the extracted files was taken.

Thanks

All thanks go out to the following users:

https://www.invoiceninja.com/forums
@billyggla
@Hillel Coren

http://www.techjamaica.com/forums/
@p1xl
@khat17

I had lots of trouble during the initial testing and setting up. These users provided suggestions and assistance through the entire process to get things going.

Setting Up

If you’re familiar with setting up some of these things you may perform the steps in any order. I will be going through in exactly the same way that I managed to get things working. You may follow if you like or read first then pick your order.

Image 001

First – get to your cPanel for HostGator and log in. We want to create an SQL database and user using the wizard. Once you’ve logged in locate the wizard from the available options.

02-SQL

Once you’ve located the wizard setup the database with whatever name and password you like. You may use the password generator available when you get to that step, but ensure that you save the information in a safe place.

Image 004Image 005

Once you’ve created the database and user you will next need to add the user to the database. This is all done automatically through the wizard – you want to ensure that the newly created user has all privileges.

Image 006 Image 007

Once this is done you want to connect to your FTP for the website and create the folder you’d like to use. This means if you want to use www.mysite.com/invoice then you’ll log on with the FTP client and create a folder in /public_html/ called invoice. If you’re going to use a sub-domain then you will need to remember this path as well. For this I called mine ninjatest and all screenshots will reflect that. Change it to whatever you’d like yours to be. So my path is /public_html/ninjatest just to be clear.

Image 012

Next you want to copy (drag and drop) all the extracted files to the FTP. Please note that this will take an extended time. Initially I tried to upload the ZIP (took about 2-3 minutes) and then use the HostGator file manager to extract and manage the files. Each time I did this it didn’t work. Suggestions from the persons that provided help said there were file permission errors which were happening as a result of using the HostGator file manager to do the extraction. While transfer via FTP took far longer (3-4 hours) it is the more reliable option. If you opt to use the HostGator file manager – or if you have another host and want to try that – you may go right ahead. It may work, it may not. If you have any errors then use the longer FTP transfer route. Once completed you want to setup a subdomain if you’re taking that route.

03-SubDomainImage 009

Ensure that your subdomain points to the /public folder within the path that you had uploaded InvoiceNinja to. Once completed you should see a confirmation.

Image 010

You should also see this subdomain populated in a list thereafter if you check.

Image 011

The next step is to ensure that PHP7 (or higher) is used in the /public folder for InvoiceNinja. To do this, go back to the main cPanel and locate the PHP SELECTOR.

04-PHP1

Once it’s up, navigate to the /public_html/ninja/public path or wherever you had it saved.

Image 017Image 018Image 019

Once you’re there, change the PHP version using the drop-down list to 7.0 or higher. For this I chose PHP EDGE (7.1) and then clicked UPDATE.

Image 021

Once it’s completed you’ll get a confirmation.

Image 022

At this point you should be able to access InvoiceNinja from one of two URLs:

  1. yoursite.com/ninja/public
  2. yoursite.com

Once it loads you can then complete the setup by filling in the fields. Please note that you may need to setup an email account for the invoice system.

Image 023 Image 027

And that’s it – you’re done! Have fun using InvoiceNinja!

A Few Notes

Cron Jobs

The system does allow you to setup cron jobs to automate sending out billing reminders and such. HostGator has options for EasyApache versions 3 and 4. If you find that running a cron fails, try the command for the other version of EasyApache.

EA4: /opt/cpanel/ea-php70/root/usr/bin/php /home/username/public_html/cron.php

EA3: /opt/php70/bin/php /home/username/public_html/cron.php

Once you’ve gotten that sorted, the instructions from Invoice Ninja state that you should use 8AM as the time. I personally changed mine to 9AM.

0 8 * * * /usr/local/bin/php /path/to/ninja/artisan ninja:send-invoices
0 8 * * * /usr/local/bin/php /path/to/ninja/artisan ninja:send-reminders

You’re going to change /usr/local/bin/php to the relevant path for EA3 or EA4 as mentioned above.

Client Access

If you don’t password protect the client portal based on the invoice links sent, ensure that you give a disclaimer to the clients. The portal is very powerful and has a dashboard with links to client historical data. This means that forwarding the email to other persons will potentially allow them to see all payments made. The recommendation is to have each client setup their password to access the portal.

Conclusion

So far everything is working. I’m still getting accustomed to it and the automation duplicates at times when I manually send things – but that’s not so bad. Once everything is streamlined it should work perfectly.

Comments

comments

Leave a Reply