Blog

We offer the articles below in the hope that they will be useful, but we cannot accept liability for any problems caused by the instructions that they contain. If you have a problem, question or feedback relating to one of our articles, please post a comment so that other readers can benefit. We regularly review comments and reply or update the articles, to ensure their continued usefulness. All articles are provided free, without any advertising or tracking, for the benefit of the technical community.

If you require paid commercial support, please contact us for assistance.

Syntax checking PHP, JavaScript, Python automatically with Git

When reviewing code, a simple first step in checking that it doesn’t include any errors is to run a syntax check. In this post, I outline how to set up tools to scan all the code in a directory for syntax errors, and how to run this scan automatically when committing your code to git. For simplicity’s sake I am assuming that you are running Ubuntu, but the principles apply to any development environment.

PHP

The command line version of PHP (package php7.x-cli) allows you to syntax check a single file:

Filtering email by country using SpamAssassin on Debian

In this post, I describe how to set up spam filtering rules based on the country that an email was sent from, using SpamAssassin. These notes are based on Debian Buster, but the principles are very similar for other versions of Debian and Ubuntu. If you run a mail server that primarily only receives mail from a few countries, this guide should be very helpful to you in the fight against spam.

PHP 7 backwards compatibility library for mysql and ereg functions

The very commonly used mysql_* and ereg* PHP functions were removed in PHP 7. For very large codebases, refactoring the code to remove them just isn't practical. To that end, we have developed a compatibility library to enable existing websites and PHP scripts to keep running under newer PHP versions.

Linux AltGr shortcuts for Vietnamese characters

Writing Vietnamese correctly requires diacritics that aren’t commonly used in Western languages. Miss one out and you completely change the meaning of what you’re writing. As I frequently communicate in Vietnamese it’s important to be able to input diacritics, which is a bit of problem since Western keyboards don’t include them. On my own laptop I use IBus to allow me to switch into UniKey mode, but it’s a bit fiddly to set up, and it’s not an option when I’m using a different computer.

Recovering a Debian server after accidental deletion of /var directory

Today I had to recover a Debian server after the /var partition was accidentally deleted. All the user generated data (primarily website content and databases) was backed up, and I also had access to a backup copy of the installed package list as generated by dpkg --get-selections. The instructions below don’t go into full detail, but hopefully they will set you on the right track. They should also work for Ubuntu installs.

If this happens to you, don’t panic, and whatever you do, don’t shut down or reboot the server!

How to upgrade the firmware on an LSI MegaRAID SAS controller under Linux

In this post, I describe how to upgrade the firmware on an LSI MegaRAID SAS controller to the latest version. Upgrading the firmware is recommended before making certain changes, e.g. installing a battery backup unit. These instructions have been tested on an LSI MegaRAID SAS 9260-4i but should also work for other models using LSI’s 2108 chipset.

How to install Composer and Drush in a multi-user configuration

In this article I'll walk through how to set up Composer, Drupal 8, and Drush in a way that means we can have multiple users running the same centralised version of Drush when appropriate (ie. when a Drupal site isn't set up as a Composer project, or a project doesn't include its own copy of Drush) which means that our team can keep using Drush seamlessly without having to install a separate copy of Composer and Drush for each user or each project on our servers. This approach should also make it easy to keep things up to date and change the configuration later on if needed.