AndyHat Consulting

Recent Posts

Setting up a web folder

This tutorial follows on from the setting up a development server tutorial and we ill be making a folder to contain our websites. Steps 1 and 2 are required while steps 3 and 4 are only required if using a linked folder like in the installing XAMPP on Unbuntu tutorial. The use of virtual servers will be covered in the next tutorial.

Step 1 Creating the folder

Open the terminal from the launcher or by pressing Ctrl-Alt-t. To create a websites folder in your home folder by typing the following in the terminal.

mkdir websites

 Step 2 Change the permissions

During the setup of the web-server a new user /group that is used by the webserver. So that the webserver can use and run code from our new websites folder we need to change the permissions on the websites folder so the Apache servers group becomes the owner. By default the Apache server creates an uses the www-data group.

To change the folder permissions so that the www-data group has ownership of the websites folder you need to type the following in the terminal

sudo chown -R :www-data websites/

If asked for the root password please enter your password.

 Step 3 Creating a link to the folder (Optional)

There are 2 ways to run the development webserver. The first uses sub folders of your localhost the second uses Apache virtual hosts.

For this step we are creating a symbolic link to our new websites folder from /var/www. Please type the following commands in the terminal.

cd /var/www
sudo ln -s /home/[username]/public_html ./[username]

A good description of the difference between symbolic links and hard links

Step 4 Creating a Test Page (Optional)

Place a test web page called index.html in the new websites folder

In your favorite editor enter the following text and save it a index.html in the websites folder.

<html><body><h1>Well done!</h1>
<p>This is web page in your websites folder.</p>

Now in your web brower’s address bar type:


You should now see the friendly “Well Done!” message.

What next?

The next tutorial will cover setting up virtual servers in Apache and using the hosts file to re-direct addresses.

Setting up a development Apache 2 web-server on Ubuntu 12.10 or 13.04

The most common type of web-server available is based on the LAMP (Linux, Apache, MySQL, PHP) bundle, so in this tutorial I will cover creating a web development server based on these components. Another common component is phpMyAdmin which is a web base MySQL administration tool so we are going to include it in our tutorial.

This tutorial guides you through installing Apache 2, MySQL 5, PHP 5 and phpMyAdmin for use as a development web-server on Ubuntu Linux. All these packages are available in the Ubuntu software centre at the versions we require.

To make a fully secure publicly available web-server it would require many other steps that aren’t always necessary when developing websites.

If you want to use the XAMPP installation instead please see my Installing XAMPP on Ubuntu tutorial.

Step 1 Updating the system

Open the terminal from the launcher or by pressing Ctrl-Alt-t.
Now before we stat installing anything you need to check for updates by typing:

sudo apt-get update

You should enter your password when prompted. If there are any updates found you should agree to update and let them install before continuing on with the installation.

Step 2 Installing the Apache 2 web server and PHP

Now that the system is up to date we can install the Apache 2 web server by typing

sudo apt-get install apache2

Next we will install PHP by typing

sudo apt-get install php5

If asked asked to confirm the installation press Y  or Enter to proceed with the installation.

As these instructions are for a development web-server we will now install the Xdebug PHP 5 debugging library (this can be skipped if you just want to host PHP websites)

sudo apt-get install php5-xdebug

Step 3 Installing the MySQL Database server

Now we need to install the MySQL Database server that we will be using to provide data for our websites by typing:

sudo apt-get install mysql-server

You may be asked to confirm the installation so press Y or Enter if needed to proceed with the installation.

You will be asked for a password for the root (administrator) user.


MySQL Password Prompt

MySQL Password Prompt

You will then be prompted to repaet the password that you jsut entered to confirm that it’s correct.

MySQL Password Confirmation

MySQL Password Confirmation

Now to allow PHP to work with MySQL we need to the php5-mysql package by typing:

sudo apt-get install php5-mysql

Step 4 Testing the Installation

Test the web-server installation in Firefox by typing localhost in the address bar.


Test Apache install

Apache test page.

Step 5 Installing the MySQL administration system (optional)

Th help use create, manage and delete MySQL databases we are goin to install the web based phpMyAdmin database administration system.

To install phpMyAdmin type the following in the terminal:

sudo apt-get install phpmyadmin

If asked asked to confirm the installation press Y  or Enter to proceed with the installation. Once downloaded you will be presented with a series of dialogs to configure phpMyAdmin with your database server and web server.

The first dialog asks what type of web server you are using. You will see a red box showing the highlighted option. The currently selected option will have beside it.

phpMyAdmin web-server selection

First phpMyAdmin set-up dialog to select the web-server type.


On the screen above make sure that the apache2 has the red highlight (use the arrow keys to select it if required) and press Space to select it (you will see a *) then press Enter.

The dialog will allow you to create the dbconfig-common database used by phpMyAdmin.

dbconfig-common set-up

Second phpMyAdmin set-up dialog to configure the database.

Make sure that the Yes option is highlighted and press Enter to configure the database.

The next dialog requests the database administrator password to create and manage databases. You need to type the password for the administrative (root) account for the database server then press Enter. The password will be obscured.

Database root password set-up

Third phpMyAdmin set-up dialog to enter the root database password.


For the next dialog you can safely select <OK> (by using the Tab key) then press Enter to generate a random database password for the phpmyadmin user.


phpMAdmin database password

Fourth phpMAdmin set-up dialog to configure the database password.

Next we will test the php, mysql and phpmyadmin installations by typing localhost/phpmyadmin in the Firefox address bar.


phpMyAdmin Test

Testing PHP, MySQL and phpMyAdmin

The user name is root and the password is the database server root password. If you can login then PHP, MySQL and phpMyAdmin are correctly installed.

 Final steps

To make the webserver usable we will need to set-up a websites folder, set-up virtual hosts and enable some required apache modules.

Limited edition 2013 calendar for sale

The Photography on Wheels limited edition 2012 calendar for now on sale. There are only 30 individually numbered and signed high quality A3 calendars available with all the photographs taken by Andy Stiller. For a sample of the pictures please look at the 2013 calendar gallery.

The calendars can only be purchased directly from me so please contact me to order yours now.

Installing XAMPP on Ubuntu 11.10 and 12.04

This tutorial has been written to help you install XAMPP on 32bit Ubuntu 11.10 or 12.04 Linux. First let me answer the question why install XAMPP rather than installing Apache, MYSQL and PHP from the Ubuntu repository. XAMPP gives you everything to run a test web server in a single portable package theoretically making it easy to copy the configuration between machines. XAMPP also gives you an easy way to only start the web server when required.

For production web servers and full time development machines it is better to use the Apache server from the Ubuntu repository. For a tutorial on setting up a full time web development machine please see my settting up Apache 2 server on Ubuntu tutorial.
These instructions are a combination and addition to those found on the Apache Friends (XAMPP) website and Upubuntu websites.

Step 1: Get XAMPP

Download XAMPP for Linux from Apache Friends. The next few steps 2 – 4 are the same as on the Apache friends website.

Step 2: Installing XAMPP

Go to a Linux shell (Ctrl-Alt_T), Change directory to the folder that XAMP was downloaded to.

cd ..\Downloads

Extract the downloaded archive file to /opt with root access:

sudo tar xvfz xampp-linux-1.7.7.tar.gz -C /opt

Any versions of XAMPP already installed in the opt folder will get overwritten by this command. Now XAMPP is now installed in the /opt/lampp directory.

Step 3: Start Apache

To start XAMPP simply call this command:

sudo /opt/lampp/lampp start

You should now see something like this on your screen:

Starting XAMPP 1.7.7...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.
Ready. Apache and MySQL are running.

Step 4: Testing the installation

OK, now to check that everything really works? Just type in the following URL in web browser:


You will now see a screen like this asking you select your language.

XAMPP Language selection page

Click the language you want and you should now see the start page of XAMPP containing some links to check the status of the installed software and some small programming examples.

Main XAMMP Intstall hoome page

Step 5 Fix Security (optional)

To make the lampp installation more secure run the lampp security wizard to set passwords and follow the on screen prompts. In the terminal window type.

sudo /opt/lampp/lampp security

Step 6 Stop Lampp

To stop XAMPP type.

sudo /opt/lampp/lampp stop

Step 7 Add XAMPP to the Unity Dash

To make XAMPP more convenient to use you might want to add it the Ubuntu Dash. For this step you will need to have the Main Menu application installed which can be done using the Ubuntu Software Centre. First open the Ubuntu 12.04 Unity Dash and start the Main Menu application.

Loading Main Menu

You should get the main menu application loaded which will look something like this.

The Main Menu application

Select the category that you want XAMPP put in (Internet) and click the New Item button. This will display the “Launcher Properties” dialog as shown below.

New launcher properties

For the type make sure that Application is selected. The Command should be:

gksudo /opt/lampp/share/xampp-control-panel/xampp-control-panel

If you want to add an icon click on the icon in the top left corner. An XAMPP icon can be found at /opt/lampp/htdocs/xampp/img/logo-big.gif

You will now need to run Lampp from the Dash to add it to the Launcher.

Step 8 Set-up a folder in user account (Optional)

If you want you can add a folder to your home directory to contain websites you want to work with.

In the terminal make sure that you are in your home folder an then create a public_html folder with.

mkdir public_html

You now need to change the permissions on the new folder to allow websites to load correctly.

sudo chmod 777 -R public_html

The next step is to create a link to new public_html in your Home folder

cd /opt/lampp/htdocs
sudo ln -s /home/[username]/public_html ./[username]

Where [username] is you current user name.

Now to check that the new folder works. Place a test web page in the public_html folder in your Home directory then start XAMPP. Now just type in the following URL in web browser:


Where [username] is you current user name.

You should now see your test web page in the browser. Well done you now have a working installation of XAMPP.



Photographic prints gallery added

I have just added a gallery of my photographic work that has been printed and is for sale. The gallery will be updated with information on whether the prints are mounted or framed.

Limited edition 2012 calendar for sale

The Photography on Wheels limited edition 2012 calendar for now on sale. There are only 50 individually numbered and signed high quality A3 calendars available with all the photographs taken by Andy Stiller.

The calendar can be purchased directly from me or from Brighton Watersports (on Brighton Seafront). For a sample of the pictures please look at the 2012 calendar gallery.

To buy a calendar directly please contact me.

Website check-list

As part of the “So you want a website” course I’ve been writing, I’ve created a simple Website check-list. It’s for anyone that is thinking of getting a website. The aim of the check list is to help you get the basic information that any web developer will need to know and to get you thinking of want you want from your new website. It covers everything from who you are and what you do to how the website should look and what it should do.

If you have problems with this check list then you need to go on my course to discover how to get the best from your web developer.

Paddle Round the Pier 2011

I’ve just finished a long exhausting, but fun weekend taking pictures at Paddle Round the Pier 2011 in Brighton. I was taking pictures for Kamikaze Boarding and for my own website. I’m just sorting through the pictures and hope that the photos will be uploaded to my Photography on wheels website,  Facebook and Flickr later in the week.

Photography on wheels goes live.

I have spent the last few weeks completely rebuilding my photography website called Photography on Wheels . The aim was to make it a smarter more interactive website that better show my photographic work. I  am pleased to announce that earlier this week I finally got the new website live and working with a range of web browsers and screen sizes.

The previous website needed to be updated as it used Gallery 2 software that is not supported. I investigated the option of trying to upgrade to Gallery 3 but found that there was insufficient documentation to make my own theme and it would only do part of the required job. I therefore decided to make the entire website using the very powerful and easy to configure zenPhoto system. The feedback I have so far has been very positive.

Secure Flight Services Online

Over the past few months I have been assisting Secure Flight Services in getting their website operational and helping to correct problems with the third party premium WordPress theme that they purchased. I am happy to announce that this first stage is now complete. I’m hoping that in the near future they will be in a position to offer me regular work providing me the opportunity to go freelance.