Install and run XAMPP (Apache, MySQl, PHP, Perl) on your local machine

Step 1: Install XAMPP

Go to to see the official site and instructions, but download the files from so it is faster.

Choose the XAMPP 1.8.3 (PHP 5.5) version appropriate for your system (Windows or Linux)

Windows users:

·        Download XAMPP Windows 1.8.3 7zip-version on your local machine under C:\

·        We will install using Method B: “Installation" without the installer: simply unzip the downloaded file, under C:\. It will create a xampp folder on C:\

·        Start a command window: click on Start, type “cmd” (without the quotes) , click Enter. In that window, change directory to C\xampp (cd C:\xampp)

·        Run setup_xampp.bat from the command window

Linux users: Follow instructions on the XAMPP website

Step 2: Start Apache web server

Windows users:

·        In a command window, start the XAMPP control center: C:\xampp\xampp-control.exe You’ll probably get a question from the security agent installed on your computer, so answer that question to allow the program to run.  The control panel window should appear next.

·        Click the “Start” button for Apache

Linux users:

Follow the instructions as - Step 3: Start

Step 3: Configure Apache to run Perl – this is already done for you when using XAMPP – DONE, so you can skip this step

In case you are curios what is needed to run Perl, here are the key facts:

Most configuration parameters for Apache are in the httpd.conf file. You can access it from the XAMPP Control Panel if you click the “Config” button for Apache and choose Apache (httpd.conf) from the contextual menu.

To run Perl, here is what is needed (already done in the XAMPP installation)

·        Inside httpd.conf, look for the line that says “Options Indexes FollowSymLinks“. “Includes ExecCGI” needs to also be there, thus it looks like this:

Options Indexes FollowSymLinks Includes ExecCGI  

·        Now look for the line “AddHandler cgi-script .cgi“. The line must be enabled, not commented out (# is the start of a comment). This will add handler for files with .cgi extension. Since we want to use .pl file extension in our server add “AddHandler cgi-script .pl” just below the above line, or add .pl on the same line. Now you will be able to execute CGI and Perl script with .cgi and .pl, extension.

AddHandler cgi-script .cgi .pl 

You must save httpd.conf and re-start the Apache webserver for any changes to have effect



Step 4: Test your setup

a.      All your files need to be inside the “Document root” directory in order to be visible to the web server. For the default XAMPP installation in Windows, the Document root is C:\xampp\htdocs For Linux, the document root is probably /opt/lampp/htdocs/

b.      Test that Apache is working: Open your browser. In the address bar of your browser, type localhost (or http://localhost).  This is how it looks like if you select “English” on the initial page: Read some of the information available, especially the “Security” link. This installation is not secure!


c.      Test that your own html files are working: Copy starter.html from the course webpage to your “Document root” folder. (any html file would work, I just use starter.html as an example)

d.      Open your browser. In the address bar of your browser, type localhost/starter.html and press enter. If the familiar page shows up, your Apache webserver is running, so go to next step to test whether it works with Perl. If you do not see this page in the browser, go to “Troubleshooting” section

e.      Test that your Perl files are working: Copy the following text and save is as in your “Document root” folder.

Important Note: the first line of the perl script should have the path to the Perl installation. So make sure that path is correct for your local machine!


### make sure the previous line has the correct path to Perl on your machine!!!!!


use strict;

use CGI qw( :standard );

use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

use Sys::Hostname;


print header();

print start_html("Test perl");

print h1("Perl runs on my computer -- woo-hoo!");

print h1(hostname() . ":" . localtime() );

print end_html();


f.       In your address bar of your browser, type localhost/ and press enter. You should see “Perl runs …” in your browser window. If you do get that, it means your webserver works with Perl!!

Step 5: (optional) Run your project from your computer

Copy your files/folders from your team drive to the local machine. You will have to change the first line of every Perl file to have the correct path to Perl on your machine, but otherwise everything should work fine. Of course, if you used absolute URLs to, all those should be changed! Use relative links/paths, whether possible.

Step 6: Uninstall

Windows users: If you followed method “B” for installation as described in this document, you should just stop Apache (from XAMPP Control Panel), close the XAMPP Control Panel, then delete the C:\xampp directory.

If you used the installer, then use the “Uninstall” option to remove XAMPP and the registry entries created by the installer

Linux users:

Stop XAMPP by calling:

/opt/lampp/lampp stop

Then to remove xampp installation do

rmrf /opt/lamp


Windows users: Sometimes, there is some other program already using port 80. In that case, your webserver cannot use it, so it will not start. You will need to stop that other program, so you can use port 80 for Apache.

a.      The XAMPP Control Panel should tell you that port 80 is already used when you try to start Apache, but in general, to see what ports are used on your computer, type the following from command line (click on “Start”, type “cmd” in the search box and press enter):


See whether TCP uses Note the PID (Process id).

b.      Now start your task manager, to see who is that process: Right-click the task bar and select Start Task Manager. Navigate to the Processes tab and, if necessary, click View > Select Columns… to ensure “PID (Process Identifier)” is checked. Also check “View processes from all users”. You can now locate the PID you noted above. The description and properties should help you determine which application is using the port.

c.      The Task Manager allows you to kill the process, but DON’T DO that — especially if it’s “NT Kernel & System”.

d.      Go to Control panel -> Administrative tools -> Services and see if you can find the one identified in the Task Manager. If it was “NT Kernel & System”, the service is probably “World Wide Web Publishing Service” or “Web Deployment Agent Service”. You should stop that service and set it to “manual” restart.

e.      Try netstatao from the command line again to see whether port 80 is still used. If yes, then the service you stopped is not the correct one, so try to find another likely candidate (send me an email).

f.       Once port 80 is not used anymore, re-start Apache. Let me know if it still does not work.