Upgrade (cleanly) from PHP 7.0 to PHP 7.1

Invoice Ninja Ubuntu – PHP 7.0 upgrade guide.

PHP 7.0 is now EOL, so time to upgrade!

You could move straight up to the latest PHP which at the time of writing is 7.2, however for our application stack, we will only be moving to 7.1

The first thing that needs to be done is all your NGINX configs need to point to the new FPM process, simply sed the conf files replacing 7.0 with 7.1

Next install all the required PHP libs

Now lets start up the 7.1 service

Lets restart NGINX so that it picks up the new PHP 7.1 fpm process

And now lets get rid of the old PHP version

Bonus points –

Remember your PHP version is now referencing a new PHP.ini file… make sure you bring across all your required changes such as session handlers etc etc

add data to session variables laravel



Compound Indexes

drop index INDEX_NAME on TABLE_NAME;

ALTER TABLE TABLE_NAME add index INDEX_NAME(col1, col2);

git squash – cleanly

git reset –soft $(git merge-base develop elasticsearch) && git commit -am “Full text search with Laravel Scout” && git rebase -i develop

Ansible apt update


search and replace from the command line


Xdebug remote server



SSH tunnel is the crucial part!

Laravel sniff DB query builder

MariaDB replication with GTID

Improves resiliency of replication in case of primary crash


Truncate file to 0 linux

echo > filename