Installation

Server Requirements

Invoice Ninja has a few system requirements. Built on top of Laravel it requires a PHP and MySQL server at a minimum with the following version and extensions installed.

You need to setup this version completely from scratch. Do not attempt to overwrite your old version of Invoice Ninja (4.x.x) with this version as the two codebases are completely different.

On ubuntu this should be as simple as running:

sudo apt install php7.4-bcmath php7.4-gmp php7.4-fileinfo php7.4-gd php7.4-json php7.4-mbstring php7.4-pdo php7.4-xml php7.4-curl php7.4-zip php7.4-gmp php7.4-mysqlnd

Installing Invoice Ninja

Installing on CentOS 8 / Ubuntu 20.04 (Recommended)

Technically computers has a very helpful step by step guide on how to install Invoice Ninja v5 from scratch onto CentOS, you can access the guide here. If Ubuntu is more your flavour you can follow his awesome guide here

Installing on Arch

If Arch Linux is more your flavor, brackenhill-mob from our forum has a very thorough step by step installation guide here

Download pre built zip. (Advanced)

A prebuilt zip can be downloaded from our GitHub release page here. You will need to download the package which is appended with -release, download the file named invoiceninja.zip.

Unzip this file into the virtual host directory you have created.

Ensure the file permission have been set to the web server user. For example in Ubuntu this is www-data if you have configured a virtual host with a root directory of /var/www/html you would set the ownership like this.

sudo chown -R www-data:www-data /var/www/html
Web server configuration

A sample NGINX configuration is provided below, it assumes you have PHP 7.4 installed with the PHP FPM extension installed

server {

listen 80;
server_name invoiceninja.test;
root /var/www/invoiceninja/public;
index index.php index.html index.htm;
client_max_body_size 20M;

gzip on;
gzip_types      application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
gzip_proxied    no-cache no-store private expired auth;
gzip_min_length 1000;

location / {
    try_files $uri $uri/ =404;
}

if (!-e $request_filename) {
    rewrite ^(.+)$ /index.php?q= last;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}

location ~ /\.ht {
    deny all;
}

}

Performance hint!

Enable gzip in your webserver configuration, this will dramatically improve the loading time of the application! Please see the above nginx configuration for a sample of how to load the components of the application with gzip.

Database server configuration

Create a database on your MySQL compatible server and add a user that has full access to the database, database configuration is out of the scope of this article, more information can be found here

Cron configuration

Ensure you set the scheduler under the web server user i.e. sudo -u www-data crontab -e

Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record.

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Navigate your browser to your installation domain name address with /setup appended i.e. www.invoiceninja.test/setup from this page you will configure your database, mailserver and the primary account user, when completed, click Submit and the app will setup your application and redirect you to the login page

Installation from git (Advanced)

For power users installing the app from Github can be done with the following steps

git clone https://github.com/invoiceninja/invoiceninja.git

git checkout v5-stable

composer install --no-dev

cp .env.example .env

php artisan key:generate

php artisan optimize
Cron configuration

Invoice Ninja relies heavily on the Laravel Scheduler, for this to operate it requires that a cron job to be configured, edit your crontab and enter the following record

Ensure you set the scheduler under the web server user i.e. sudo -u www-data crontab -e

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Some Webservers require the Cronjob to end with > /dev/null 2>&1 instead of >> /dev/null 2>&1 for it to work. Also check if your Webserver Cronjob needs to be set with /private_html/ instead of /public_html/ within the path. And sometimes it's enough to put php instead of /opt/alt/php73/usr/bin/php in the cronjob scheduler command to execute.

If you still encounter errors, it may be helpful to temporarily remove >> /dev/null 2>&1 from the cron, this should output the cron to the cron.log

Configure your virtual host, create a database and point your browser to http://your.domain.com/setup and follow the bouncing ball!

Shared Hosting

Server Requirements

We have tested Invoice Ninja v5 on shared hosting and can confirm that it does work. There are several checks you will need to do prior to confirming whether your Shared Host has the correctly enabled modules. Invoice Ninja relies on:

Without these modules, you will not be able to run Invoice Ninja. We do include some preflight checks of these modules in the Setup workflow, but it is best to check with your host that they support these modules. Some hosts choose to disable these modules as they classify them as security risks.

Database configuration

Create a MySQL compatible database in your shared host control panel along with a database user, record the database name, username and password as you'll need this later. Ensure your database user has full access to the database you've just created.

Upload release asset

Download the latest release from our Releases page. Note, you'll want to find the latest release which will contain 3 files, the one you need will be annotated as invoiceninja.zip.

Upload this file to your shared host, typically if your webhost uses the industry standard cPanel, you'll want to upload the invoiceninja.zip file to the public_html directory. Once the upload has completed, using the file manager unzip the file.

Run setup

Navigate to https://your.url.com/setup and fill in the form. The setup process will perform some pre flight checks and then attempt run the setup. If it has been successful you will be navigated to the Admin portal. If the setup fails for some reason, you'll be returned to the Setup screen with an error message, there may be additional errors reported in storage/logs/laravel.log that will provide more information where the setup has failed.

If you see a 404 webserver error and use sub.domain.com make sure to point the path for the subdomain towards the /public folder from the extracted invoiceninja.zip file, for example: /domains/domain.com/public_html/invoices2/public/

Add the cron job

Add the Laravel scheduler cron job, be sure to include the full path, for a cPanel host it should look like this:

* * * * * cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

Installing Invoice Ninja (Docker)

If you prefer to use Docker, we have a dedicated repository with detailed instructions on how to get started HERE

Want to contribute? Edit this page on GitHub!