Category: Uncategorized

PHP setlocale and strftime Not Working

I was recently having problems displaying the day and month name in my local language after a server move. This was due to a missing locale.

If you don’t have shell access to your server, you may need to contact your web host for assistance. Firstly, check which locales are currently installed on the server. locale -a en_US.utf8 Above we can see only en_US.utf8 is installed. If your required locale is missing, you may need to install it using dpkg-reconfigure locales. sudo pkg-reconfigure…

Continue reading PHP setlocale and strftime Not Working

How to Run Multiple PHP Versions with Apache on Ubuntu 18.04 / 16.04

How to Run Multiple PHP Versions with Apache on Ubuntu 18.04 / 16.04

In this guide we will configure Apache to run PHP 7.x and PHP 5.6 simultaneously, and choose between them using Virtual Hosts or .htaccess.

Prerequisites This guide assumes you have Apache already installed and serving web pages. If you need to install Apache, please see: Installing Apache on Ubuntu 18.04 with Virtual Hosts Installing Apache on Ubuntu 16.04 / 17.10 with Virtual Hosts 1. Add Repository Let’s begin by updating the package lists. sudo apt update For Ubuntu 18.04 users, install libapache2-mod-fcgid. sudo…

Continue reading How to Run Multiple PHP Versions with Apache on Ubuntu 18.04 / 16.04

How to Install VNC on Ubuntu 18.04 (Windows, Linux and Mac)

How to Install VNC on Ubuntu 18.04 & 16.04 (Windows, Linux and Mac)

In this guide we will install the xfce4 desktop environment and VNC server to allow us to control Ubuntu 18.04 remotely from Linux, Mac or Windows. This guide has also been tested on Ubuntu 16.04 to Ubuntu 17.10.

Prerequisites You should use a non-root user account with sudo privileges. Please see the Initial Server Setup for Ubuntu 18.04 / 18.10 or Initial Server Setup for Ubuntu 16.04 / 17.10 for more details. You will also need to download and install a VNC client for your OS. We recommend the following: Windows VNC Viewer (RealVNC), TightVNC or UltraVNC For Windows users,…

Continue reading How to Install VNC on Ubuntu 18.04 & 16.04 (Windows, Linux and Mac)

How to Back Up MySQL Databases with Linux Command Line

How to Back Up MySQL Databases with Linux Command Line and Automate with Cron

It’s important to make frequent automated backups of your MySQL databases should you ever accidentally alter data or suffer a hack. In this guide we will learn how to use mysqldump to export databases and use crontab to automate the entire process.

1. Prepare MySQL Backup Folder There is no particular recommended folder to back up to in Linux so you can choose this yourself. In this guide, we are saving backups to /var/mysql_backups/. Ideally you would store these on an external drive or an offsite server, but in this guide we will focus on creating backups locally.…

Continue reading How to Back Up MySQL Databases with Linux Command Line and Automate with Cron

How to Reset MySQL Root Password in Ubuntu

How to Reset the MySQL Root Password on Ubuntu

In this article we will reset the MySQL root password in Ubuntu by starting MySQL with the --skip-grant-tables option.

1. Confirm MySQL version Firstly, you must confirm which version of MySQL on Ubuntu you are running as commands will be different. mysql -V mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper Keep note of your “Distrib”. In the above example, we are on MySQL 5.7. Keep note of this for later. 2. Restart…

Continue reading How to Reset the MySQL Root Password on Ubuntu

Cloudflare Origin SSL certificate

How to Configure Cloudflare Origin CA for Apache

Cloudflare Origin CA provides a secure SSL connection between your server (“origin”) and Cloudflare. In this article we will configure an Origin cert for Apache on Ubuntu.

1. Generate Cert and Private Key Log in to Cloudflare and navigate to the Crypto page. Scroll down to Origin Certificates and click Create Certificate. In Origin Certificate Installation, the defaults should be Private Key Type: RSA with 15 years validity. Click Next. In the next screen, the Key format should be PEM (default) and Web Server…

Continue reading How to Configure Cloudflare Origin CA for Apache

Automatically Back Up Your Web Server Doc Root with Tar and Cron

Automatically Back Up Your Web Server Doc Root with Tar and Cron

It’s important to make frequent automated backups of your web server’s document root should you ever accidentally delete files or suffer a hack.  In this guide, we will make daily and monthly automated backups of our document root using tar to make “tarball” archives and crontab to automate the entire process.

1. Prepare Backup Folder There is no particular recommended folder to back up to in Linux so you can choose this yourself. In this guide, we are saving backups to /var/www_backup/. Ideally you would store these on an external drive or an offsite server, but in this guide we will focus on creating backups locally.…

Continue reading Automatically Back Up Your Web Server Doc Root with Tar and Cron

Manual: Linux Shell Script Date Format

  %FORMAT String Description %% a literal % %a locale’s abbreviated weekday name (e.g., Sun) %A locale’s full weekday name (e.g., Sunday) %b locale’s abbreviated month name (e.g., Jan) %B locale’s full month name (e.g., January) %c locale’s date and time (e.g., Thu Mar 3 23:05:25 2005) %C century; like %Y, except omit last two…

Continue reading Manual: Linux Shell Script Date Format

Disable Sudo Password Prompt or Extend Timeout in Linux

Every time you issue a sudo command, Linux asks for your user password after a certain inactivity timeout, usually 5 minutes. This is the recommended behaviour to prevent unauthorised commands being run by someone or a malicious script in your absence. However, this requirement can be disabled per session or permanently, or you can extend the inactivity timeout.

Disable Per Session This command below will prompt you for your sudo password once and never again until you log out and in again. sudo -i Extend Inactivity Timeout The default inactivity timeout is usually 5 minutes before Linux will prompt for your sudo password again. You can extend this timeout by editing the sudoers file.…

Continue reading Disable Sudo Password Prompt or Extend Timeout in Linux

site.webmanifest 401 404 not found error

404/401 Error on site.webmanifest

The web app manifest is a simple JSON file that tells the browser about your web application and how it should behave when ‘installed’ on the user’s mobile device or desktop, such as when the user adds the website to their iPhone or Android home screen.

A typical manifest file includes information about the app name, icons it should use, the start_url it should start at when launched, and more. It is often used by favicon generators for websites. site.webmanifest { “name”: “”, “short_name”: “”, “icons”: [ { “src”: “/android-chrome-192×192.png”, “sizes”: “192×192”, “type”: “image/png” }, { “src”: “/android-chrome-256×256.png”, “sizes”: “256×256”, “type”:…

Continue reading 404/401 Error on site.webmanifest