Creating a website – Part 7

Database Setup

In Part 6 we created an Entity Relationship Diagram for our database, including a junction table to link the ‘keyword’ table to the ‘photo’ table. Now it is time to set up the database so we will be able to use it when we begin the coding. The first thing we want to do is install a program called Xampp. This can be downloaded from the Apache website here. Run the program and you will be presented with the install window. There is no need to make any changes to what is being installed so you can just click ‘Next’ as in figure 1.0.

XAMPP Install Window
figure 1.0

During the installation, you may receive a Windows Security Alert similar to figure 1.1. Just click on ‘Allow access’. Although we will be running this program – and the website – locally, Xampp essentially acts as a server so we can run our website as if it was actually live. This is how web development is done – the last thing we want it to develop a website on a live server as there will always be errors and security issues during coding which will leave the server wide-open to unsavoury characters who may try and use these to cause problems on the server.

Xampp Windows Security Alert Window Image
figure 1.1

Once the installation has been completed, you will be given the option to start the control panel. Ensure this is selected and click ‘Finish’ (figure 1.2).

Xampp Setup Compete Window Image
figure 1.2

The Xampp control panel is where we start all the services and make all configurations that we need to be able to run our website. For what we will be doing – creating a website with a database – we only need the Apache, and MySQL services running. These can be started by clicking ‘Start’ next to each of these options and will appear green to show they are running successfully (figure 1.3).

If things did not go smoothly for you or either of them won’t start, the Apache support forum will be the place to go. It is extremely useful as your answer will be in there – it will be rare to come across an issue that someone else hasn’t come across themselves and had it fixed!

Xampp Control Panel Image
figure 1.3

The final check is to ensure it is working in the browser which will show us that the Apache server is running and we can be sure that when we start coding our website we will be able to run. The way to do this is go to a new tab in your browser and type: ‘localhost’ (without quotes), and press Enter. This should display the Apache dashboard which will look similar to figure 1.4. As of writing the version was 8.2.0, but you may have a different version. This will not affect the way we create the database and website so there is no need to worry.

If you look at the address bar, you will see that it says: http://localhost/dashboard/. The ‘localhost’ part will be on anything you do locally so you know that it is on your machine and not on a live server, and you don’t have to worry when the website breaks.

Localhost Page Image
figure 1.4

« Creating a Website – Part 6Creating a Website – Part 8 »