Downloading and Installing XAMPP on Windows

Before downloading XAMPP, make sure that you either stop the current running instance of MySQL, or uninstall it (if any). XAMPP comes with its own MySQL distribution.

1. Installing XAMPP

Download the XAMPP Installer version for Windows from

   http://www.apachefriends.org/en/xampp-windows.html

Double click the installer .exe and just follow the installation wizard. On the screen XAMPP Options you will be asked if you want to install Apache and MySQL as a service. This means that they will start up when you start your computer, and if you plan to do a lot of development beyond this class, then you can select this option. If not, you can always start XAMPP from the control panel before using it.

2. Testing XAMPP

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 (unless already running)
  3. Create a file in Notepad (or similar text editor) named myPHPtest.php (note that the file extension must be ".php" (instead of ".htm").
  4. Insert the following code in the file:

       <?php echo "Hello World! This is my PHP test!"; ?>

  5. Save the file in the folder C:\xampp\htdocs.
  6. Open the file in your browser with the address

       http://localhost/myPHPtest.php

If the browser writes Hello World! This is my PHP test! the installation was successful, and you're ready to run PHP on your computer. Otherwise, see the XAMPP website for more information, or use the forums for support.

Remember to always save your files and folders in htdocs (full path is C:\xampp\htdocs\).

You will also need to launch the file via a url (e.g.: http://localhost/myphpfile.php) in the browser address bar, not by double-clicking an icon or via the File Open menu option. In each of the two latter cases, the .php file is not being processed by the web server and thus not being routed to PHP for parsing/execution.