How to install, start and test XAMPP on Windows for Introduction to PHP

  • google plus

In Brief...

XAMPP is a free distribution package that makes it easy to install Apache Web Server, PHP, PEAR, and MySQL. Before installing XAMPP, you should turn off any other web servers and instances of MySQL you have running on your Windows machine.

Take our Introduction to PHP Training course for free.

See the Course Outline and Register

Instructions

Installing XAMPP on Windows

  1. Download and Install Visual Studio 2008 redistributable package because XAMPP will need this to run properly.
  2. Download and Install XAMPP for PHP 5.X for Windows- Be sure to select the proper version of PHP as there are many choices.
  3. Allow the program to make changes to your machine.
  4. It is VERY important to install on the root of c:\. If you don't, some functions of XAMPP may have restrictions that will force you to adjust the settings in your UAC, which isn't recommended.
  5. Double-click on the new XAMPP Control Desktop shortcut or Use the Search feature in Windows 10 to find the XAMPP Control App, which opens up the XAMPP Control Panel Application. There you will see a column of "Start" buttons. Select the ones for MySQL and for Apache...you should now see a green "Running" indicator Installing XAMPP on Windows

Testing your XAMPP Installation

In your web browser, go to http://localhost. You should see the start page of XAMPP:XAMPP Start Page for Windows

Lab Files

  1. Download the class files
  2. After downloading the class files, create a folder in htdocs named "Webucator" and extract your class files in that folder.

Setting the MySQL Password on Windows

The PHP files use "pwdpwd" for the MySQL root password, while the default password is NO password.

  1. Click Admin next to MySQL on the XAMPP Control Panel to bring up the phpMyAdmin.
  2. Choose the mysql database on the left.
  3. Then choose the SQL tab on the top and run the following statement:
  4. update user set Password=PASSWORD('pwdpwd') where User = 'root';

  5. You also need to update line 21 of the xampp/phpMyAdmin/config.inc.php file with the new password (pwdpwd). Password change for MySQL on Windows Note: In order to connect to the myPHPAdmin center, you must do these steps in order.

Installing Northwind Database using XAMPP

NOTE: you should download the class files above before following these instructions, as it contains the Northwinds Database file(s).

  1. To install the Northwind database used in class, click Admin next to MySQL on the XAMPP Control Panel to bring up the phpMyAdmin. That should take you to http://localhost/phpmyadmin.
  2. If it asks you to login, the username is root and the password is pwdpwd.
  3. On that page, click on the Import link under the Localhost heading. After, it should say "Importing into the current server".
  4. Browse to the Northwind-MySQL.sql file in your class files (c:\xampp\htdocs\Webucator).
  5. Click the Go button on the bottom left of the page.
  6. You should get a Success message and Northwind should be added to your list of Databases.

Recommended Code Editor

  • Visual Studio Code (Download, Install, and Set up)
    • While you may use a different editor or IDE, Visual Studio Code is an excellent IDE to learn to code on. It provides a nice balance of power and simplicity and it is available on Windows and Mac.
  • Designate your testing server in Dreamweaver

    NOTE: The following only applies if you are using Dreamweaver. If you are not, please ignore this section.

    1. Go to Site, then New Site.
    2. In the Site Setup dialog, fill in the Site Name (e.g., PHP) and browse to the Local Site Folder (e.g., c:\XAMPP\htdocs\Webucator\ClassFiles\ on Windows or \Applications\XAMPP\xamppfiles\htdocs\ on a Mac).
    3. Choose the Servers tab.
    4. At the bottom of the box on the right, click +.
    5. On the Basic tab, provide a Server Name, set Connect using to Local/Network, ensure the Server Folder matches the local site folder you specified in step 2, and set the Web URL to http://localhost/Webucator/ClassFiles/.
    6. Click the Advanced button.
    7. In the Server Model field, select PHP MySQL.
    8. Click Save. The server should appear in the table on the Servers tab.
    9. Make sure that both the Remote and Testing checkboxes are checked.
    10. Click Save.

    Testing PHP Files

    All your class files should be located in C:\xampp\htdocs\Webucator\ClassFiles\

    To test any of the class files in your browser, say C:\xampp\htdocs\Webucator\ClassFiles\PHPBasics\Demos\HelloWorld.php, you can use 1 of 2 methods:

    1. Method 1:
      1. Go to http://localhost/Webucator/ClassFiles/PHPBasics/Demos/HelloWorld.php in your web browser.
      2. Follow the same pattern to view all other class files; basically the C:\xampp\htdocs\ gets changed to http://localhost/
    2. Method 2:
      1. Go to http://localhost/Webucator/ClassFiles/ in your web browser.
      2. Bookmark that page in your browser for easy access to it from now on.
      3. From there, you can see all the lesson folders and drill down to any class file for testing/viewing.

    And that's it

    Happy Windows XAMPPing!

    Author: Deborah Kling

    Debbie manages the support and setup for Webucator's classes.

    Discuss