Category Archives: Server

Server side rendering with phpv8/v8js on Ubuntu requires phpv8/v8js. Here is how to install the latest (at the time of writing) with php7.1.

Add the latest ppa from this guy:

Update the sources:

Install libv8:

Install and compile v8js

Optionally remove the files from the install from /tmp.

After this the SSR of the example vuejs app should work.

Apache files as not www-data

There used to be a pretty cool mod for apache that allowed it to run certain vhosts as someone other than www-data.

Unfortunately this mod has not been kept up to date and doesn’t work reliably on newer versions of Apache2. As such you are left with a dilema, either act as apache or add apache and yourself to a group who has rights to the files.

For a dev server the better option IMO is to allow devs to ssh in as apache and thus nothing else is required. Each dev can sync their files and everything just works nicely. The reason for this is the usual suspect, Windows. Although there is Cygwin which gives linux toolbox to Windows users, there is still no way around syncing between Linux and Windows and the permissions being correct. Windows and *nix file systems are just fundamentally different. Don’t believe me, try it out for yourself, either:

  1. Rsync a fileset from a linux server to a windows desktop. Now try work on them or sync them back or even try commit the changes to git.. no joy.
  2. Rsync a  fileset from a windows desktop to a linux server.. it is basically not possible yet to retain all the file permissions. Doesn’t matter which flags you add.

Back to the topic

NB: To see users and groups see this post: previous post

Create a new usergroup webdev and add the www-data user to it and then any other users you need in this group.

At this point you have a group apache and you can both write within it. Now in the folder with the files you want to work on and apache to server you need to apply a default group:

Next we can verify:


Last thing to do is to make sure, the group webdev has rwx rights on the files

Restore a destroyed USB drive

Please note: this deletes all data on the target device and requires a real OS (so no Macs or Windows 😉 ).

I enjoy trying out new Linux distrobutions from time to time, occasionally I destroy the odd USB stick as my knowledge on partition tables is not where I would like it to be. I found a series of commands that will restore a USB stick to its former glory (even when gparted or any other program says it’s basically bin worthy)

Install prerequisite:

Assuming the target USB is at /dev/sdb

(please check first with lsblk or gnome-disks or sudo fdisk -l and be sure you know what you are formatting)

Make sure the device has no mounted filesystem and unmount it if necessary, for example:

Destroy existing partition table:

Create new GPT:

Format as FAT32:

Check it:

Should output something like:

That’s it, your stick should be clean.

Mount HDD Linux and automount with fstab

1 – Check the drive is visible to the os

Which should spit out something like this:


instead of using fdisk you could also use

if you cannot see your drive, or you don’t have a parition yet see here

2 – Create a mount point

A mount point is basically an empty folder, typically this is in either /media or /mnt on linux systems. So choose one and create a sub-directory:

3 – Auto-mount the drive with fstab

To mount the drive reliably you should mount via the UUID, this is specific to the partition.

This will output a list of UUID’s to screen, based on the output from fdisk above you should be able to recognise which line belongs to which drive.

Now add a new new entry to /etc/fstab:

4 – Mount all from fstab

That’s it. You should now be able to see the contents of your drive in you mount point. A system reboot will auto-mount the drive again.

To unmount temporarily just unmount the mount point:


FIX: “Warning: No support for locale: en_GB.UTF-8”

Linux Mint 17 and seeing this warning ..

update-initramfs: Generating /boot/initrd.img-3.0.0-12-generic
Warning: No support for locale: en_GB.UTF-8

The problem is that /usr/share/initramfs-tools/hooks/root_locale is expecting to see individual locale directories in /usr/lib/locale, but locale-gen is configured to generate an archive file by default.

Fixed it by running:

Which should output something like:

Now run:

Stop services starting up on boot Ubuntu eg: MySQL or Apache

So running Linux Mint is great! I effectively develop on an OS extremely close to the production environment, I can run apache vhosts or nginx proxies, MySQL and MongoDB and it’s all just like production.

If you have ever tried developing on windows you are aware of the pains, slow php, ridiculous permission systems, tonnes of “updates” aka spyware. I have collegues who snigger then proudly point to their fashion accessory with a glowing apple on the cover… this is no better IMO. Yes apple have reasonable hardware and they are sturdy.. but the OS is defintely not for the serious programmer, multiple windows with no task bar for a start. Brew? And don’t get me starting on the hell hole that is xcode or the app store! And have you tried working on one of the those macs where they hide half the keys, what’s with that?

Anyway, enough windows and apple bashing as I could fill up an entire post on this topic. Back to the original topic.

OK, so the example is to disbale mysql on startup:

You should now be able to see a new file:

That’s pretty much it. The command basically writes a file with manual in it. Reboot your computer and you should find mysql is not started. This is great, you can now have many services ready and waiting, start them up as and when you want them eg:


Running PLEX Media server as another user and serving files from another location

A. Create /etc/systemd/system/plexmediaserver.service.d. In it, create override.conf containing the following

INFO: It appears some systems want Umask while others want UMask. Please be cautious of this until fully resolved and noted here.

B. Now copy the existing library. (Resolve errors before deleting the original copy of your library)

C. Inform SystemD of the changes and test the related & reconfigured PMS

D. Test your system. Verify everything is exactly as it was. If not, resolve before proceeding

E. Delete the old library in /var

Once you have created the override file, you can later edit it with systemctl edit plexmediaserver


thanks to this forum post:

Mounting a windows partition in Linux

Mounting a windows partition in a Linux OS (eg Linux Mint dual booting) requires the format be readable in Linux eg ntfs, but in Windows 8+ they added a new little “joy” preventing the partition from being unmounted.

The new feature is called Fastboot, this basically does not unmount the partition resulting in any other operating system throwing an error when attempting to read. To turn this feature off (and from experience the cold boot speed is not that much faster, maybe around 5 seconds):

  1. Head to control panel -> power options -> system settings
  2. The following dialog should then be shown:
  3. Click the link “Change settings that are current unavailable”
  4. Uncheck the option for “Turn on fast start-up (recommended)”
  5. Lastly, be aware that on major Windows updates they seem to think it a great idea to reset all the bulls#@t settings to their default including this one and most likely the one that uses your machine as a node in their Windows update network. If the world was run by good people MS would not be able get away with this.. but hey… what can you do.. oh yeah.. don’t use Windows 😉

See also this link