Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

This is a legacy installation guide for Invoice Ninja v4—not a way to install the current release. The archived v4 instructions specify PHP 7.1 or 7.2; current Invoice Ninja documentation calls for newer PHP and Ubuntu versions. Ubuntu 16.04 and 18.04 have both passed the end of standard security maintenance, so do not use this stack for a new public-facing production server. See the archived v4 installation documentation, the current requirements, and Ubuntu’s release-cycle page before proceeding.

Use these steps only when you have a reason to maintain v4 on an existing legacy host. The commands below do not make an obsolete operating system or PHP branch safe. If you cannot obtain a trustworthy, version-pinned v4 release and compatible packages from sources you trust, stop and plan a migration instead.

Confirm the version and decide whether to proceed

The PHP 7.2 requirement belongs to the archived Invoice Ninja v4 installation instructions. It does not apply to current Invoice Ninja generally. Current documentation lists Ubuntu 20.04 or newer and PHP 8.1 or higher; the current self-host guide uses PHP 8.2 in its manual-install example. Check the current requirements and current self-host installation guide if you are starting from scratch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Target What the cited documentation says Practical implication
Archived Invoice Ninja v4 PHP 7.1 or 7.2; see the archived v4 guide. Keep v4 and its runtime separate from current v5 instructions.
Current Invoice Ninja Current getting-started documentation lists PHP 8.1+, Ubuntu 20.04+, and MySQL 5.7+ or MariaDB 10.3+; the current self-host example uses PHP 8.2. Use the current official instructions on a supported host rather than PHP 7.2.
Ubuntu 16.04 Standard support ended in April 2021; any extended coverage depends on Ubuntu Pro and related terms. Do not treat an old package repository or server image as maintained by default.
Ubuntu 18.04 Standard support ended in May 2023; any extended coverage depends on Ubuntu Pro and related terms. Prefer migration for a new deployment or Internet-facing service.

Both Ubuntu dates are from Ubuntu’s release-cycle information. PHP 7.2 is also an obsolete branch. Old packages may have moved or disappeared, and old TLS, OpenSSL, database, kernel, and web-server behavior can differ from what an old tutorial assumes.

#1 Best Overall
XKDOUS 2 Pack Invoice Books, 2-Part Carbonless Receipt Books
  • Two-Part Carbonless Invoice Book: Each invoice book has 50 sets of invoices, each with a white/light yellow section, with the yellow section retained in the invoice book to maintain detailed records.
  • Consecutively Numbered: Enlarged red 6-digit numbers in the upper right corner of each invoice receipt book help you quickly navigate through your orders.
  • Wraparound Divider Flap: A thick folded cardboard divider is integrated into the back of each invoice book for use between each two-part sales order to prevent the written content from rubbing off on subsequent copies of the invoice, resulting in wasted invoices.
  • 2 Packs/50 Sets (100 Sets Total): Each invoice book provides 50 sequentially numbered carbonless sets of 2 invoice books for long-term use.
  • Customizable Space: Each invoice book for small business has space at the top to add a company seal or sticker.

Proceed only when the legacy constraint is real

  • Use this path only when an existing v4 instance or a compatibility constraint requires it.
  • Have a migration plan, a backup destination, and a tested way to restore the application and database.
  • Restrict access where possible, keep the host isolated from unrelated services, and use firewalling and monitoring. Do not expose an obsolete stack casually.
  • Do not overwrite a v4 installation with v5 files. The current self-host guide says v5 is not an in-place upgrade from v4 and calls for a clean installation before data migration.

Prepare the host, DNS, and firewall

You need a clean Ubuntu 16.04 or 18.04 host, root or sudo access, a DNS name such as invoice.example.com, and a static public IP if the service will be reachable from the Internet. Arrange SMTP access, a backup destination, and a trusted source for the application release before you begin.

Set DNS to resolve to the host before requesting a TLS certificate. If you are connected remotely, confirm SSH access before enabling a firewall; a mistaken firewall rule can lock you out.

sudo apt update
sudo apt upgrade -y
sudo timedatectl set-timezone UTC
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status verbose

On an end-of-life Ubuntu installation, apt update or package installation may fail because the configured repositories no longer serve the release. Do not “fix” that by adding an arbitrary mirror or untrusted package source to an Internet-facing system. Treat inability to obtain maintained, trusted packages as a reason to migrate or isolate the workload.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Nginx and MariaDB, then create a database

Install the server packages from the trusted repositories configured for the host. Repository availability varies on these obsolete releases; confirm the origin and version of each package before relying on it.

sudo apt install -y nginx mariadb-server
sudo mysql_secure_installation

Create a database and a local-only database account. Replace the example password with a long random secret and keep it in a password manager or protected deployment notes; never reuse a tutorial password.

sudo mariadb
CREATE DATABASE invoiceninja
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

CREATE USER 'invoiceninja'@'localhost'
  IDENTIFIED BY 'REPLACE_WITH_A_LONG_RANDOM_PASSWORD';

GRANT ALL PRIVILEGES ON invoiceninja.*
  TO 'invoiceninja'@'localhost';

FLUSH PRIVILEGES;
EXIT;

Test the credentials:

mysql -u invoiceninja -p invoiceninja

Do not grant remote database access unless the architecture genuinely requires it. The current Invoice Ninja documentation lists MariaDB 10.3+ or MySQL 5.7+, but that current floor should not be assumed to describe every v4 release. Check the selected v4 release’s own compatibility information before choosing a database version.

Install PHP 7.2-FPM with release-specific caution

Ubuntu 18.04

PHP 7.2 was the distribution-era PHP version for Ubuntu 18.04, but repository state and package availability can change on an end-of-life host. If the packages are available from a source you trust, a typical legacy package set is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install -y 
  php7.2 php7.2-cli php7.2-fpm php7.2-common 
  php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring 
  php7.2-xml php7.2-zip php7.2-bcmath php7.2-bz2 
  unzip curl git

Validate extensions against the exact v4 release and its dependency lock file; this list is a practical starting point, not a guarantee that every release has identical requirements. The archived v4 guide describes PHP and MySQL requirements, while the current guide’s newer extension list applies to current installations, not automatically to v4.

Ubuntu 16.04

Do not assume apt install php7.2-fpm will work on an unmodified Ubuntu 16.04 installation. Its typical distribution-era PHP was 7.0, so PHP 7.2 may require a third-party package source. That source may no longer publish packages for an end-of-life Ubuntu release. Do not blindly add an old PPA or install packages from an untrusted origin; if a trusted, maintained source cannot provide the runtime, stop and migrate rather than bypass package security.

Rank #2
Invoice Receipt Book with Cardboard 2-Part Carbonless, 5.5" x 8.5" Order Forms, 50 Sheets Carbonless Sales Invoice Book for Small Business
  • PACKAGE INCLUDES - Our invoice book per pack has 50 sets sheets, Total of 100 sheets. red code printed on each page with consecutive numbers
  • Material - Receipt book is excellent quality carbonless paper is used in their production, tears off easily along the perforation.
  • A5 Size - Sales invoice book size of 5.5" x 8.5", and forms are 2 part carbonless white/yellow sets on a sturdy chipboard backing
  • WIDE APPLICATION - Sales reciepts/invoice book for small business is ideal for restaurants, food trucks, vendors, service provider, photographers, caterers, florists, bakeries, cafes, boutiques and salons

Verify PHP and FPM

php -v
php -m
systemctl status php7.2-fpm
ls -l /run/php/php7.2-fpm.sock

Confirm that the command-line interpreter reports PHP 7.2.x, the FPM service is active, and the socket exists. If your package source uses a different socket path, use the actual path in the Nginx configuration.

Set practical PHP limits

In the PHP 7.2 FPM configuration, set workload-appropriate starting values such as:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
memory_limit = 512M
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 120
date.timezone = UTC

These are operational starting points, not universal requirements. Adjust them to the host’s memory and expected upload size. Restart FPM after editing:

sudo systemctl restart php7.2-fpm

php -i reports the CLI configuration, which can differ from FPM. You can inspect effective FPM settings through a temporary, access-restricted phpinfo() page if necessary, but delete that page immediately afterward; leaving it public exposes server configuration.

Obtain a pinned Invoice Ninja v4 release

Do not download an unversioned “latest” package for a PHP 7.2 installation. The archived v4 documentation identifies v4.5.50 as a v4 documentation target and distinguishes v5 instructions, but this guide does not establish that a particular archive URL or checksum is currently available. Select and verify an exact v4 release from the project’s release information before installation. The project repository is github.com/invoiceninja/invoiceninja; the archived instructions also point to release information.

If the selected release provides a project-hosted ZIP archive, download that exact version from its verified release page, then inspect it before extracting. Do not replace the version-specific link with a moving download endpoint:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd /tmp
# Download the exact, verified v4 release archive from its project release page.
# Save it as invoiceninja.zip, then inspect its digest:
sha256sum invoiceninja.zip

Compare the SHA-256 value with a checksum published by the project for that exact archive, if one is available. No authoritative checksum is established here; a locally calculated digest alone does not prove the file is authentic.

The archived v4 guide says its ZIP includes third-party libraries, whereas a Git checkout requires Composer. If you use source, verify that the selected tag exists before cloning, then install dependencies only as that release directs:

cd /var/www
sudo git clone --branch v4.5.50 --depth 1 
  https://github.com/invoiceninja/invoiceninja.git invoiceninja

Use that command only if the project actually publishes the tag and the tag is the release you intend to run. A current Composer release may itself require a newer PHP version or resolve dependencies in a way that does not suit an old PHP 7.2 application. Use the Composer version and dependency procedure documented for the exact v4 release; do not run composer update casually on a production installation.

Rank #3
Sale
Adams Sales Order Book, 2-Part, Carbonless, White/Canary, 4-3/16 x 7-3/16 Inches, 50 Sets per Book (DC4705)
  • QUALITY INVOICES: Adams Order books provide a professional invoice or customer receipt; a great way to create and maintain a professional image for small businesses and service providers
  • 50 TWO-PART CARBONLESS FORMS: Customers get the perforated white top copy; retain the canary and pink copies for your records
  • WRAP-AROUND COVER: Fold the back cover between sets to keep invoices neat and legible
  • ROOM FOR CUSTOMIZATION: A blank space at top leaves room for your company stamp; a big savings over custom-printed forms
  • CONSECUTIVELY NUMBERED: Large 6-digit numbers in the upper right hand corner help you thumb through orders quickly

Set application ownership and permissions

For a straightforward installation where PHP-FPM runs as www-data, use the web-server account as owner and grant write access only to runtime paths. The archived v4 instructions call out storage, bootstrap, and public/logo.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo chown -R www-data:www-data /var/www/invoiceninja
sudo find /var/www/invoiceninja -type d -exec chmod 755 {} ;
sudo find /var/www/invoiceninja -type f -exec chmod 644 {} ;
sudo chmod -R 775 
  /var/www/invoiceninja/storage 
  /var/www/invoiceninja/bootstrap 
  /var/www/invoiceninja/public/logo

Confirm the exact writable directories required by your chosen release. Never use chmod -R 777. If you deploy releases with a separate account, preserve a clear ownership model so FPM can write where needed without making application source broadly writable.

Configure Nginx with the public directory as document root

The document root must be the application’s public directory, not the repository root. This keeps non-public application files outside the web root. Create /etc/nginx/sites-available/invoiceninja with a server block like this, replacing the domain and confirming the socket path:

server {
    listen 80;
    listen [::]:80;

    server_name invoice.example.com;

    root /var/www/invoiceninja/public;
    index index.php index.html;

    client_max_body_size 20M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

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

    location ~ /. {
        deny all;
    }
}

Enable the site and test the configuration before reloading Nginx:

sudo ln -s /etc/nginx/sites-available/invoiceninja 
  /etc/nginx/sites-enabled/invoiceninja
sudo nginx -t
sudo systemctl reload nginx

This follows the important architecture in the current official Nginx example—public-directory root, front-controller fallback, and PHP-FPM—without copying its PHP 8.2 socket into a PHP 7.2 setup. The sample is a starting configuration, not a substitute for reviewing your Nginx version and release-specific security requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable HTTPS before completing setup

Do not treat plain HTTP as a completed deployment. The hostname must resolve to the server, and ports 80 and 443 must be reachable for a typical HTTP-based certificate flow. On old Ubuntu releases, the distribution’s Certbot package may itself be outdated or unavailable, so validate the installation method against the exact host rather than assuming the package command remains current.

If the package source is appropriate for the host, a typical Nginx Certbot flow is:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d invoice.example.com
sudo certbot renew --dry-run

Set the application URL to https://invoice.example.com. HTTPS protects browser traffic; it does not configure SMTP or guarantee that mail will be accepted by recipients.

Complete the browser setup

Visit the HTTPS hostname and complete the v4 setup screen. The archived guide describes entering database and email settings and creating the first administrator account. Use the dedicated database credentials created above.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Money and Rent Receipt Book 2-Part Carbonless 7-5/8" x 11" Spiral Bound 200 Sets per Book 4 Receipts per Page(1pack)
  • Long-lasting utility: 100 sheets per book, offering a total of 400 sets for extended use, Size 7-5/8" x 11".
  • Two-Part Carbonless Copy: Achieve clean and legible copies for your records with the carbonless copy paper, making organization a breeze.
  • Spiral Bound Design: Convenient and user-friendly, the spiral binding allows for easy flipping and writing, ensuring a seamless record-keeping experience.
  • Ample Space: Each page accommodates 4 receipts, providing plenty of room to note down detailed information for each transaction.
  • Professional-Grade: Ideal for landlords, businesses, and individuals, this receipt book is a reliable and professional tool for tracking financial transactions accurately.
  • Application URL: the final HTTPS URL.
  • Database host: commonly localhost or 127.0.0.1, according to the application’s connection behavior.
  • Database name, database user, and the generated database password.
  • Mail transport and SMTP hostname, port, username, password, and encryption mode.
  • Administrator email address and a unique, strong password.

A local mail transfer agent does not guarantee deliverability. A hosted SMTP relay may require provider-specific authentication and DNS records such as SPF, DKIM, and DMARC. The archived DigitalOcean image description warned that mail sent through its included Postfix setup could be rejected without additional configuration; that description is historical and does not establish current image availability.

If the installer creates an .env file, protect it from other local users:

sudo chown www-data:www-data /var/www/invoiceninja/.env
sudo chmod 640 /var/www/invoiceninja/.env

Remove any temporary diagnostic page such as public/phpinfo.php immediately after checking it:

sudo rm -f /var/www/invoiceninja/public/phpinfo.php

Schedule the Laravel task runner

A site that loads is not necessarily fully operational. Invoice Ninja uses scheduled work for functions such as recurring invoices and reminders. The current official documentation gives the Laravel scheduler pattern of running every minute; confirm the precise command for the specific v4 release before adopting it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the PHP 7.2 binary path:

command -v php7.2

If the selected v4 release uses the standard Laravel scheduler command, add a cron entry for the FPM user:

sudo crontab -u www-data -e
* * * * * cd /var/www/invoiceninja && /usr/bin/php7.2 artisan schedule:run >> /dev/null 2>&1

Use the actual path reported for PHP 7.2. Test the job as the same account and inspect the application and system logs if it fails:

sudo -u www-data /usr/bin/php7.2 
  /var/www/invoiceninja/artisan schedule:run -v
sudo tail -n 100 /var/log/syslog
sudo tail -n 100 /var/www/invoiceninja/storage/logs/laravel.log

Cron is necessary for scheduled behavior but does not by itself guarantee successful reminders or recurring invoices; application configuration, mail delivery, permissions, and any release-specific background-work requirements also matter.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Back up and test restoration

Keep recoverable copies of the database and application data in a separate, access-controlled destination. Include the configuration and uploaded files; a database dump alone is not a complete application backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Database: create a consistent MariaDB dump and store it off-host.
  • Configuration: protect the application’s .env file and any deployment-specific configuration.
  • Application data: back up storage, uploaded documents, and logos.
  • Application key: retain the key securely with the backup. The project repository warns that losing APP_KEY prevents the application from operating correctly with encrypted data.
  • Restore test: periodically restore into an isolated environment and verify that the application can read the database and files.

Do not store database dumps or secrets in a publicly served directory.

Best Value
Sale
Better Office Products Sales Order Book, 6 Pack Sales Order Book 2 Part Carbonless, 5-7/16 x 8-7/16, 50 Sets per Book, White/Canary, Sales Receipt Book for Business Invoices & Records
  • 6-PACK/50 Sets (300 Total Sets): Six 5-7/16 x 8-7/16" bound Sales Order Books with two-part forms which produces two identical records of each sales transaction, one for the customer and one for your business
  • CARBONLESS COPY: No carbon paper! Each 2-part set features a white top sheet for recording each transaction and a bottom canary yellow sheet that captures written text from top sheet.
  • CONSECUTIVE NUMBERS: Effortlessly identify the chronological order of transactions in each book by the pre-printed number on each sales order set
  • WRAPAROUND DIVIDER FLAP: A thick, folded paperboard divider is integrated into the back of each book to use between each 2-part sales order form.
  • PERSONALIZE: Each sales order form sheet contains space at the top to add a company stamp or sticker

Troubleshoot common installation failures

E: Unable to locate package php7.2-fpm

On Ubuntu 16.04, the default packages may provide PHP 7.0 rather than 7.2. On either EOL release, repositories may be unavailable or a third-party source may have dropped the release. Identify the operating system and inspect configured package sources before making changes:

lsb_release -a
grep -Rhv '^s*#' /etc/apt/sources.list /etc/apt/sources.list.d/

Do not install a random package or add an untrusted repository. Prefer migration or a controlled, isolated legacy runtime if trusted packages cannot be obtained.

Nginx returns 502 Bad Gateway

Check whether FPM is running, whether its socket exists, and whether Nginx points to that exact socket:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl status php7.2-fpm
sudo ls -l /run/php/
sudo nginx -t
sudo tail -n 100 /var/log/nginx/error.log

Common causes include a wrong socket path, stopped FPM service, version mismatch, permissions or AppArmor restrictions, or a stale PHP socket copied from another configuration.

Application routes return 404

  • Confirm the Nginx root ends in /public.
  • Confirm the try_files fallback sends requests to /index.php?$query_string.
  • Check that the site is enabled and the request reaches the intended virtual host.

The installer or application returns HTTP 500

Read the application and Nginx error logs before changing permissions or dependencies:

sudo tail -n 100 /var/www/invoiceninja/storage/logs/laravel.log
sudo tail -n 100 /var/log/nginx/error.log

Likely causes include a missing PHP extension, wrong runtime version, unwritable runtime directory, malformed or missing .env, application-key problems, incompatible Composer dependencies, or incorrect database credentials or collation.

Composer reports missing classes or incompatible dependencies

Check that source files, dependency lock file, Composer version, and runtime PHP all belong to the same pinned v4 release. Do not mix v4 and v5 files or update dependencies without a release-specific reason. Restore the pinned archive or checkout if an unplanned dependency update altered the installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PDF generation fails

Check the PHP memory limit, required image extensions such as GD, writable storage and temporary directories, and whether asset URLs use the correct HTTPS application URL. The exact requirements depend on the selected v4 release.

Email does not send

Verify SMTP hostname, port, credentials, encryption mode, outbound firewall policy, provider authentication requirements, and mail DNS records. Inspect application logs and ask whether the provider accepts connections using the host’s legacy TLS stack. A local Postfix service alone is not proof of deliverability.

Scheduled invoices or reminders do not run

Verify the cron entry, its PHP binary, and its working directory, then run the scheduler as www-data and inspect logs:

sudo crontab -u www-data -l
sudo -u www-data /usr/bin/php7.2 
  /var/www/invoiceninja/artisan schedule:run -v

Choose a safer route for a new deployment

For a new installation, use a supported Ubuntu release and the current Invoice Ninja v5 requirements rather than recreating this PHP 7.2 stack. The official self-host guide covers current manual and container options and warns that v5 is not an in-place upgrade from v4. Keep v4-to-v5 migration as a separate, backed-up project.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Containers such as Docker can isolate dependencies and improve reproducibility, but they do not remove the need to patch, monitor, back up persistent volumes, or verify the provenance of any legacy image. Current Invoice Ninja documentation lists container and managed deployment options; verify the available application version and migration path before choosing one. A hosted service or managed platform may be a better fit for a business that does not want to operate the database, web server, TLS, backups, and mail delivery itself.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.