Hackathons/Laptop setup/Windows web server

Install XAMPP to get Apache and PHP
XAMPP is a community-built distribution of Apache, MySQL, PHP, and more. We will use it to provide Apache and PHP, the two basic elements of a PHP web serving system.

To do that, download this program, and after it is saved, run it:


 * http://hivelocity.dl.sourceforge.net/project/xampp/XAMPP%20Windows/1.7.7/xampp-win32-1.7.7-VC9-installer.exe

(If you need help with that step, see a staff member.)

As it runs, it will ask you a bunch of questions, You can always click Next to accept the defaults. Finally, you will be offered the chance to Install. Click that, and you will see a lot of file names listed as software is installed on your computer.

Finally, it will ask you to click Finish to declare that you are done with the installer. The installer will ask you if you want to start the XAMPP Control Panel. For now, click No.

Start the XAMPP Apache server
By default, XAMPP does not run the web server; it instead lets you decide when it should be enabled.

We will use the "XAMPP Control Panel" to run the web server. First, we have to launch the control panel. To do that:


 * Click Start, then Programs, then Apache Friends, then XAMPP, then click XAMPP Control Panel.
 * When the Control Panel tool launches, find the "Start" button next to the word "Apache". Click it.
 * You should notice that near the word Apache, the word Running appears in green. Additionally, Windows may ask you if you want to permit Apache to listen for network requests. You should Permit it.

Note: If you find later on, perhaps after you turn your computer off and on, that you can't access your web server, you may need to return to this step to start the web server.

Save a sample PHP file
In this step, we store a simple PHP file in the place where the web server will run it.

Open up a command prompt, as you have done before. Change directory into the path used by the web server:

c:   cd c:/xampp/htdocs

We will use the text editor called notepad++ to create a sample PHP file. To start the editor:


 * Click Start, then Programs. Choose Notepad++, then click Notepad++
 * Type this text exactly into the box:




 * Click "File" and choose "Save". Save your work in the following path:

C:\XAMPP\htdocs\sample.php

Finally, load up this URL in your favorite web browser: http://localhost/sample.php. You should see the word "sweet", and nothing else.

If that works, great! If not, raise your hand and get help from a helper.

Clean up (remove) the sample PHP file
Now that we know PHP works, we will delete the PHP file by using a terminal. (This is good practice, as many of the other tasks will require using a terminal.)


 * Open a command prompt. (If you forgot how, check out the instructions earlier in the laptop setup.)
 * Type this into the prompt, remembering to press enter after every line:

c: cd c:\xampp\htdocs del sample.php

Okay, great. Apache is installed, and we know it can run PHP.

Return to laptop setup
&laquo; Return to laptop setup