Do you want a site made with WordPress, with Drupal, with Joomla, or with some
other software? ... 1) Apache (The most commonly used web server software).
Setting Up A WAMP Server On Your Windows Desktop Richard Underwood US English Edition This edition published May 2016 Previous edition 2011 in pen-name of David Ipswich Published at Smashwords Copyright 2016 Richard Underwood License Notes This book is licensed for your personal enjoyment only and may not be re-sold or given away to other people. If you would like to share this book with another person please purchase an additional copy for each recipient. If you are reading this book and did not purchase it, or it was not purchased for you, then please purchase your own copy. Thank you for respecting the hard work of the author. ~~~~~~~~~~~~~~~~~~~~~~~~~~ Table of Contents Introduction Obtaining the Resources Installing the Server Software Launching Your Server Icon Does Not Turn Green Creating Your First Home Page Your First PHP Database The Server Menu Where To Next About the Author
INTRODUCTION None of us is perfect, and everyone who creates websites makes the occasional mistake. Therefore, if you do intend creating a website it is a good idea to make it on your own computer
first, and only download it to a 'live' server once you are fully happy with it. If you make mistakes on a 'live' website, the Google-bot will index those pages, but when it returns later (after you have deleted the offending pages) Google won't be able to find them. This may make Google wary of indexing future pages, or it may only index one or two pages when you want it to list your whole site. You do not want to upset Google, so make sure you make your mistakes in private! Take the opportunity of trying things out. Do you want one column, two columns or three columns? Do you want black text on a pale background, pale text on a dark background, or something in between? Do you want a site made with WordPress, with Drupal, with Joomla, or with some other software? With a desktop server you can try them all!
OBTAINING THE RESOURCES So you need a Windows desktop server … but what EXACTLY do you need? For a basic Windows server you need the following: 1) Apache (The most commonly used web server software) 2) MySQL (A relational database for holding all the information) 3) PHP (a scripting language used for producing dynamic web pages) This combination of software on a Windows desktop is known as WAMP server software (Windows, Apache, MySQL, PHP). If you have a Linux computer, it is known as LAMP server software. (Linux, Apache, MySQL, PHP). If you are familiar with Linux, then you probably already know how to install a LAMP server, so this eBook concentrates on the vast majority of people, who will be use Windows. If you are using Windows and want to install a server, you need to install Apache, MySQL, and PHP software. The good news is that all this software is free and easily obtainable. Now you could search the internet for all three pieces of software and install them separately (yawn!), but a much better way is to install a single package that already contains all three in a single application (quicker and easier). There are several such packages available but we're going to use the one which is probably the most widely used one called WampServer. WampServer is available from http://www.wampserver.com/en/ Scroll down the home page to the 'Downloads' section, and you will find two yellow boxes, one providing a 32-bit version and the other providing a 64-bit version. If you are unsure whether your computer is 32-bit or 64-bit, go to your Windows Control Panel, click on “System” and it'll tell you which you have. Your Control Panel can be found as follows: (Windows 7): Start Button>Control Panel>System and Security>System
(Windows 8): Desktop View>Charms Bar>Settings>Control Panel> System and Security>System (Windows 10): Start Button>All aps>Windows System>Control Panel>System and Security>System Once you are sure which version to download (32-bit or 64-bit) simply click on the appropriate yellow box on the WampServer.com page (you need to allow pop-ups). The pop-up will contain a warning that you should not install the latest version of WampServer over earlier versions, and a warning that you need to have Microsoft's Visual Studio installed (if you do not have, then follow the link to install it directly from Microsoft). Towards the top right of the pop-up there will also be a link where you can directly download WampServer. Clicking on that link will take you to the Sourceforge site from where the latest edition of WampServer will automatically start to download to your desktop.
INSTALLING THE SERVER SOFTWARE Once the software has finished downloading, find it on your desktop (Figure 001)
Figure 001 Double click on it to start the installation process. (Figure 002)
Figure 002 Close any other applications you've got open, then click on the 'Next' button and read the License Agreement (Figure 003)
Figure 003 Click on 'I accept the agreement', and then click on the 'Next' button. You can choose where WampServer2 is installed. (Figure 004)
Figure 004 I would recommend leaving the default of “C:\wamp”, then click on the 'Next' button. The next choice is a matter of personal preference. Leave blank or make your choice, then click on the 'Next' button (figure 005).
Figure 005 Click on the 'Install' button (Figure 006)
Figure 006 Wait! Switch the kettle on and make yourself a coffee whilst you wait (figure 007).
Figure 007 WampServer2 may be able to tell what browser you usually use. If not, it will ask you to choose. Choose your browser then click on the 'Open' button. If you are not sure, just click on the 'Open' button anyway! Depending on your firewall settings, you may be asked to allow the Apache Server to access your networks. If you are asked, then click to 'Allow access' to your private network. Leave the default values. (Figure 008) Then click on the 'Next' button.
Figure 008 Click on the 'Launch WampServer 2 now' box to enter a tick if it is not already ticked, and
then click on the 'Finish' button (figure 009)
Figure 009
LAUNCHING YOUR SERVER When WampServer2 has launched, you should see an icon at the bottom right of your computer screen like the one below (Figure 010). It will usually start red colored, and then change to orange before finally changing to green. The red indicates that none of the servers components have started yet, the orange indicates that some of the server components have started, and the green indicates that all the server components have started. If the icon does not turn green then see the following 'Icon Does Not Turn Green' section.
Figure 010 If you cannot see the icon, go to the small triangle symbol at the bottom of your screen. It should say 'Show hidden icons' if you hover over the triangle (figure 011).
Figure 011 Clicking on the triangle will display the hidden icons. (Figure 012)
Figure 012 Then click on the green 'W' WampServer2 icon. Clicking that icon displays the WampServer menu, from where you can access all the various parts of the server (figure 013).
Figure 013 Click on the top part of the menu, where it says 'Localhost'. If your installation completed correctly, your browser should look like this (Figure 014)
Figure 014
Your WampServer2 will close down whenever you close Windows, and it will not re-start automatically when you re-start windows. To re-start the server simply click on the icon on your desktop or launch bar, or go to 'Start', 'All Programs' (Windows 7 or 8) or 'All apps' (Windows 10).
ICON DOES NOT TURN GREEN In all my years of using WampServer, I have only ever known it have one problem during the installation process, and website forums are full of people who have had the same problem For the vast majority the WampServer will have installed correctly and you can miss out this section and skip forward to the next section. However, what if the icon didn’t turn green but stayed on red, or orange? If it remains on RED, left click on the icon to open its menu, and then click on ‘Restart All Services’. Once it has turned green, left click on the icon again and click on the ‘Put Online’ button. If the icon stays on ORANGE, this is usually because one part of the services is not running. The WampServer uses port 80 on your computer, and an orange icon is invariably caused by the WampServer not being able to access that port. WampServer uses port 80 but so do other programs, and it’s a case of ‘first come first served’. If something is already using port 80 then the WampServer cannot access it. The usual culprit is that you have got Skype installed, or that you’re using Windows 8 or Windows 10. If you are using Skype it is simply a case of turning it off whilst you use the server. If you cannot avoid using both at the same time, make sure Skype is off and start the WampServer first, then start Skype second. Skype will find port 80 is already in use and find another port to use. Another thing you can do in Skype is to select Tools/Options/Advanced/Connection and then uncheck ‘Use port 80 and 443 as alternatives for incoming connections’. If Skype is not the problem, then you need to find out what is using port 80. You can do this by clicking on the WampServer icon, then on 'Apache', then on 'Service', and then on 'Test Port 80' (figure 015).
Figure 015 The pop-up screen will tell you what is using port 80. There is another way of checking what is using port 80 but this is a bit more fiddly process so I will take you through it step by step In Windows 7 click on the ‘Start’ button. Type cmd in the search box then press ‘Enter’. This opens up the command line. On the command line type the following: netstat -aon : findstr 0.0:80 Press ‘Enter’. The bottom line of the resulting display will look something like the following: TCP 0.0.0.0:80 0.0.0.0.:0 Listening 1234 This line of the display shows port 80 on the left (shown as 0.0.0.0.80) and a PID or Process Identification number on the far right (shown as Listening 1234). The PID is a number that identifies what is listening on port 80. Make a note of the number. Next, click on Ctr/Shift/Esc (all at the same time). This opens the task manager. Click on the ‘Processes’ tab. On the top menu click on View/Select columns, and in the screen that opens make sure there is a tick in the top ‘PID (Process Identifier)’ box then click OK. In the PID column, find the PID number that you previously made a note of. This time make a note of the name of the service. Next, from your Windows Start button, go to Control Panel/Administrative Tools/Services (just ‘Services’ not ‘Component Services’) and scroll down the list to find the name of the service from the previous step. Right click on the name of the service, and then click on ‘Properties’. In the box that opens find the setting for ‘Startup type’ and use the drop down list to change the setting to ‘Manual’.
What we have done is to find out what is using port 80, and then we have stopped that process from starting automatically. From now onwards that process will not automatically start using port 80 when we start the computer, but only start if we manually start that specific process concerned. This leaves the server free to use port 80 at all other times. If your WampServer icon is still on orange, left click on the WampServer icon to open its menu and click on ‘Restart All Services’. Once it has turned green, left click on the icon again and click on the ‘Put Online’ button. In Windows 8, the process is basically the same. Windows 8 by default has a program named 'Internet Information Services' (or IIS) using port 80, but it does not need to be using it so that setting too can be set to ‘Manual’. Windows 10 also has the same program using port 80, but you will not need it. To stop the program from running go to 'Start>All Aps>Windows System>Control Panel>Programs. Click on the link that says 'Turn Windows features on or off' and then remove any ticks from the two 'Internet Information Services' lines. Click on 'OK' to save your changes and then restart WAMP. If you are worried about turning off the 'Internet Information Services' I can assure you that you do not need it unless you are using the version of Windows known as 'Windows NT' or if you have a commercial license to use it. If all else fails! Usually WampServer installs and works without any problem, but if it does not work, by far the most common reason is that something else is using port 80, and I’ve given the remedy for that in the above section. I have used WampServer on lots of different computers and never come across any other difficulty, but there are exceptions to every rule. If you are still having problems the best place to ask for advice would be at the forum on the WampServer.com/en site.
CREATING YOUR FIRST HOME PAGE Once WampServer has been installed and is working correctly, when you click on the icon and then click on the top part of the menu where it says 'Localhost' you are viewing the in-built home page (Figure 016)
Figure 016 You can also create your own by opening 'Notepad' and typing the following (Figure 017)
My OWN HOME PAGE
This is my first HOME PAGE
Written for my own server
Figure 017 To save the file click on 'File' then on 'Save As'. The box containing the words 'Text Documents' has a drop-down menu accessed by clicking the downward facing arrow at the right-hand side of the box. Click on that downward facing arrow and select 'All Files'. In the 'File name' box make the name of the file 'index.html' and save the file to your C>wamp>www folder (Figure 018)
Figure 018 You can delete the existing index.php and testmysql.php files. These are the files that displayed the original 'localhost' page.
If you now return to the WampServer2 menu and click on 'Localhost' (Figure 019)
Figure 019 Your browser should open with your newly created home page. (Figure 020)
Figure 020 So, you now know that whatever you place in the C>wamp>www folder creates a website that can be accessed in your browser at http://localhost/ You could, if you wished, create a whole site like the first page we've created, but it would be rather basic. Most sites these days are created using software such as WordPress, Joomla, Drupal etc. but you now know that whichever software you use, the software should be downloaded into your C>wamp>www folder. WordPress, Joomla, and Drupal are all installed in a similar way. You download the software to your C>wamp>www folder, and then go to http://localhost/ and follow the on-screen instructions. All the above software requires a database to work, and at some stage in the installation procedure for all three programs you will be asked for the name of the database, and for the name and password of the database user.
YOUR FIRST PHP DATABASE Almost all website building software use a PHP database to hold their web content. To create your first PHP database, go to WampServer2>phpMyAdmin (Figure 021)
Figure 021 This opens the phpMyAdmin page in your browser (Figure 022) and you need to make sure you are on the 'Databases' tab as this is where your databases are administered.
Figure 022 To create a new database, simply type in the name you want to call your database into the 'Database name' box and click on the 'Create' button. We have created a database, so the next thing we need to do is to create the first database user by clicking on the 'Users' tab and then on the 'Add user' link.
Figure 023 In the box (figure 023) add your own 'User name' in the top right-hand box. Type 'localhost' in the next box down, and in the following two boxes on the right add your password. DO NOT click on the “Generate” button. This does not save what you have typed, but generates a random password (that you probably won't remember) so it is much better to choose your own. Under the section you have just completed there are a couple of other sections. Scroll down to the 'Global privileges' section and click in the 'Check All' box to add a tick. This should automatically add a tick to all the boxes that follow. When you have finished, scroll down to the bottom right of the page and click on the “Go” button.
THE SERVER MENU The server has many different settings and add-ons. To access them whenever your server is running, simply click on the triangle symbol, and then click on the WampServer2 icon. Let's look at the PHP menu. (Figure 024)
Figure 024 When you put your mouse over the PHP menu, other options appear, such as 'Version', 'PHP settings' etc. and putting your mouse over 'PHP settings' (Wamp>PHP>PHP settings) you will see all the PHP settings, and which settings are 'activated' (ticked) and which settings are 'not activated' (un-ticked) (figure 025).
Figure 025 PHP extensions and Apache modules are all activated or deactivated in a similar fashion. You will probably find all the PHP and Apache default settings to be correct, but occasionally your software may call for PHP or Apache settings that are not activated by default. In that event simply click on the setting to add a tick and activate it.
WHERE TO NEXT? Having shown you how to install and set up your own server, what settings you now go on to make will depend upon what software you intend running on your site. All of the software mentioned in the next paragraph will work on your new server. Content management systems such as WordPress, Joomla, Drupal or one of the others, all require different settings; as do Zen Cart, Cube Cart, osCommerce or any of the other ecommerce cart software. For most of these programs, you install the software in your C>wamp>www folder, and open 'localhost' in your browser. The program will usually tell you if you need any of the other settings turning on, and will usually ask for details of your database name and database user name and password. That is about as far as I can take you in this free eBook. The permutations from here are endless, so it just would not be feasible to provide all the options. I hope this eBook inspires you to take things further and that now your server is installed I hope you will go on to install one of the above content management systems to create your website. In most cases, once your site is exactly how you like it on your own server, it can be easily moved to a permanent remote server and made into a live site. Usually this involves copying all the files from C>wamp>www to your remote server, copying your database content onto the new database on your remote server, and linking the two together.
ABOUT THE AUTHOR Richard Underwood first became a lecturer in computer usage whilst working for the Technology Section of a Government Office in 1994, and by 1996 had designed his first website and was working for a Regional Technology Network liaising between universities and technology based businesses. Over the years he has designed hundreds of websites, and has been consulted on the creation and design of many ecommerce sites. He can be contacted via his Facebook page at https://www.facebook.com/RichardUnderwoodAuthor/