Install XAMPP

Download

Start by downloading XAMPP by following these links to downloads and installation guides:

Install

Just follow the instructions on the screen during the installation process. Below are screenshots from an installation on Windows.

1. Choose the "Installer" download on the XAMPP website:

XAMPP download

2. Run the file and choose C:\xampp as the install location:

XAMPP install

3. You don't need to choose any "Service Sections":

XAMPP install

4. Click "Finish" when the installation process is complete:

XAMPP install

When you have downloaded and installed XAMPP, you can start the server and save your future PHP documents in the folder c:\xampp\htdocs on your computer and access them in the browser with the address http://localhost.

Test

You can test whether XAMPP runs properly by following the steps below:

1. Open the program XAMPP Control Panel

2. Start the Apache server and the MySql server:

XAMPP start servers

3. Create a file in Notepad (or similar text editor) named test.php (note that the file extension must be ".php" instead of ".htm").

4. Insert the following code in the file:

<?php echo "Hello World!"; ?>

5. Save the file in the folder "c:\xampp\htdocs".

6. Open the file in your browser with the address http://localhost/test.php.

If the browser writes "Hello World!" the installation is successful, and you're ready to run PHP on your computer. Otherwise, see below for how to fix common problems, see the XAMPP website for more information, or use the forums for support.

Common problems

1. Apache server won't start

If the Apache server won't start, it is probably because some other application is using port 80. Most likely Skype or Microsoft IIS.

If you use Skype: start Skype, selecting Tools > Options > Connections and un-check the use of Port 80 as an alternative port. Then close and re-start Skype.

If you have installed IIS: Follow this guide and uncheck Internet Information Server (IIS).

If none of this helps, follow these steps to find the program that is using port 80:

  1. Go to command prompt (Start > Run > cmd).
  2. Type in: netstat -aon
  3. You will see a list of IP numbers, port numbers and the process ID (PID).
  4. Look for the row with 127.0.0.1:80 and remember the process ID.
  5. Open up Task Manager (Start > Run > taskmgr).
  6. Go to Process tab, click View > Select Columns...
  7. Tick PID (Process Identifier)
  8. Search the process that has the same process ID shown in netstat and close the program.

2. I don't know where to save my PHP files

You should always save your files in the "htdocs"-folder. If you have made a standard installation in Windows (see above) the path is "c:\xampp\htdocs\":

XAMPP
  • In Notepad choose "Save as..." under "File" in the top menu.
  • Find the "\htdocs\" folder (click on the folder-icon next to the path (see image above), and type: "C:\xampp\htdocs")
  • Choose "All Files" in the "Save as type" box. This is very important - otherwise, you save it as a text document and not as an PHP file.
  • Now save your document as i.e. "page.php" (the ending ".php" indicates that it is an PHP file).

You can now open the file in your browser with the address http://localhost/page.php and enjoy the fruits of your labor.


Related topics in the PHP ForumRepliesViews
WHERE CAN I PUT THIS CODE THAT CONNECT TO DATA BASE XAMPP?17390
losing track with XAMPP17714
working with XAMPP19000
loading images from database in xampp giving trouble37898
Parse error: syntax error, unexpected '>' in C:\xampp\htdocs16809

+ Post a new topic


<< Lesson 2: Servers

Lesson 3: Your first PHP page >>