How To Install PHP 5.6 on Ubuntu 16.04

I just upgraded one of my Ubuntu Servers to Ubuntu 16.04.  The media wiki installation shopped working because it now comes with PHP 7.  I tried upgrading mediawiki to the latest version but this didn’t seem to work either.   I can’t seem to find out if Mediawiki support PHP 7.  So, I thought I would install PHP 5.6 in parallel on Ubuntu 16.04 by using a PPA (which I generally don’t like)

Here are the commands that I used:

add-apt-repository ppa:ondrej/php
apt update
apt install php5.6 libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-mysql
a2dismod php7.0
a2enmod php5.6
systemctl restart apache2

Hope this helps someone.


Apache config error Invalid command ‘php_flag’ Ubuntu 16.04

I have just started to upgrade some servers to Ubuntu 16.04.  It looked good until I rebooted to the server and the Apache2 service didn’t start up properly.  I view the logs in systemd.  Using the command:

systemctl status apache2.service

● apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
Active: failed (Result: exit-code) since Tue 2016-04-26 13:29:37 EDT; 7min ago
Docs: man:systemd-sysv-generator(8)
Process: 1343 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apr 26 13:29:37 hostname apache2[1343]:  * The apache2 configtest failed.
Apr 26 13:29:37 hostname apache2[1343]: Output of config test was:
Apr 26 13:29:37 hostname apache2[1343]: AH00526: Syntax error on line 59 of /etc/apache2/apache2.conf:
Apr 26 13:29:37 hostname apache2[1343]: Invalid command ‘php_flag’, perhaps misspelled or defined by a module not included in the server configuration
Apr 26 13:29:37 hostname apache2[1343]: Action ‘configtest’ failed.
Apr 26 13:29:37 hostname apache2[1343]: The Apache error log may have more information.
Apr 26 13:29:37 hostname systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 26 13:29:37 hostname systemd[1]: Failed to start LSB: Apache2 web server.
Apr 26 13:29:37 hostname systemd[1]: apache2.service: Unit entered failed state.
Apr 26 13:29:37 hostname systemd[1]: apache2.service: Failed with result ‘exit-code’.

I did a Apache2ctl config test like so:

AH00526: Syntax error on line 59 of /etc/apache2/apache2.conf:
Invalid command ‘php_flag’, perhaps misspelled or defined by a module not included in the server configuration
Action ‘configtest’ failed.
The Apache error log may have more information.

The problem is the setting “php_flag engine off” and “php_admin_value engine Off” settings.  Which looks like so.  This setting stops php files being executed in certain folders (such a image folder etc).

<DirectoryMatch ^.*/somewhere/>
AllowOverride None
  php_flag engine off
php_admin_value engine Off

I removed both of these and restarted apache again using:

sudo systemctl start apache2.service

Hope this helps someone else.

How to move the Unity menu to the bottom – Ubuntu 16.04

There are two ways of move the Unity menu from the side to the bottom.   You can either move the launcher to the bottom using a single command line statement or dconf.  The best way is just to cut and paste this command into a terminal

gsettings set com.canonical.Unity.Launcher launcher-position Bottom

This setting will stay and the Unity menu with stay at the bottom even after a reboot.  You can also move the menu back to the left hand side like so:

gsettings set com.canonical.Unity.Launcher launcher-position Left

Voila.  You are good to go 🙂


How To Set The Default Paper Size To A4 in Firefox

I am running Firefox on Ubuntu and the default paper size was US Letter.  I wanted to set the default paper size to A4.  There isn’t a graphically interface to do this.  So you have to:

  1. Visit about:config
  2. Search letter
  3. You should have a result with a value of na_letter.
  4. Double click to modify and change the value to A4

Then it should look like this:



Hopefully that helps someone change the default paper size from US Letter to A4.

How To Connect Phone To Mazda Mx3 via bluetooth

My friend has a reasonably new Mazda MX3.  Unfortunately she could not get her phone to connect to the Mazda’s bluetooth.  The main problem was that the Mazda bluetooth never appeared as a device on her iPhone.   She asked me to help and we followed the instructions in the manual.  The instructions for connecting a phone via bluetooth are:

  • Get your phone out and enable bluetooth
  • Navigate through the menu on the car
  • Select ‘BT Setup’ – annoying the last item in the menu
  • Select ‘Pair Device’
  • You are then offered a pin (by default 0000).
  • You should then see the car appear as a device on your phone (by default Mazda).
  • You then theoretically click on Mazda and then enter the pin.
  • You should then be connected…

The problem for us was that the Mazda never appeared as a device.   This means you can’t select it on the phone and the car just shows an ‘Err’ message during the BT setup process.   If you Google around for solutions, they all say you need to reset you whole car by disconnecting the battery or go to a dealer.  Well, who wants to do that!

The Solution

The solution we found was to setup the phone through the voice command system.   So, this is how to connect your phone to a Mazda via bluetooth.

  • Hold down the phone button on the steering wheel.
  • The car should go into ‘Listening’ mode and you then need to speak to it.
  • Say ‘Pairing options’
  • Then follow the instructions all the way through to the end which finishes with giving a name for your phone (you can make this up).  Please note – don’t give up too early (even if you think you have completed) because unless you name you phone it won’t be able to connect.

Voila – you should finally have connected your iPhone to your Mazda bluetooth.  I hope this helps someone.