XAMPP Setup

This is a short introduction to help you set up a local web server (XAMPP). For more information on XAMPP, please visit https://www.apachefriends.org.
(Please tell me if you find any errors or omissions in the document —Upsorn Praphamontripong, 22-May-2022)

XAMPP is an open source package that is widely used for PHP development. XAMPP contains MariaDB, PHP, and Perl; it provides a graphical interface for SQL (phpMyAdmin), making it easy to maintain data in a relational database.

Install XAMPP

  1. Download XAMPP from Apache's Download page.

    If you visit the main page of Apache (https://www.apachefriends.org) as shown below, do not download  "XAMPP for Windows"  or  "XAMPP for OS X"  directly on this page. They are Virtual Machines, which require additional configuration. Please navigate to other download versions. Do not download a Virtual Machine (VM) version

    If you plan to write PHP programs and later deploy them on Google Cloud Platform (GCP), you may want to download PHP 7.4.

    [22-May-2022] The stable version GCP App Engine supports is PHP 7.4. GCP App Engine appears to have some issues with PHP 8.1.

    Apache main page

  2. Run the downloaded file (.dmg for Mac users; .exe for Windows users) to install XAMPP. Be sure to remember where XAMPP installs to. You will need to access it later.

Start the servers

  1. Go to the location where XAMPP is installed and open XAMPP manager / control file.
    • For Mac users, by default, after running the download, a folder named XAMPP will be created in your Mac Applications. Go to XAMPP folder, open an application called  manager-osx.  Alternatively, you may access  manager-osx  app via  LaunchPad.

      sample screen showing the first page of XAMPP (Mac)

      Note: depending on the version you choose, your sceen may look different from the above sample screen. However, the features / options should be similar.

    • For Windows users, by default, all XAMPP files will be in  C://xampp.  Go to  C://xampp,  open an application called  xampp-control.exe.

      sample screen showing the first page of XAMPP (Windows)
      (Thanks to Ryan Ritzo for the content and image)

      Note: depending on the version you choose, your sceen may look different from the above sample screen. However, the features / options should be similar.

  2. Start the servers
    • MySQL Database — for a database server
    • Apache Web Server — for PHP environment

      sample screen to start the servers

    Note:  phpMyAdmin  runs on a PHP environment. To use  phpMyAdmin  to manage databases, Apache Web server must be started.
    Some troubleshootings:
    • If MySQL database server does not start and no other MySQL database has been running on your machine, it is possible that the default port number (3306) has been used by another software on your machine. Try to configure the port; use a free port number (for example, 3307).

      sample screen to configure the port number

    • If MySQL database server does not start and you may have MySQL setup or run on your machine previously, it is possible that the MySQL server did not stop properly. Try to terminate all MySQL-related transactions / processes; use a terminal, type the following command
          sudo killall mysqld
    • If Apache Web server does not start, it is possible that the default port (80) is being used by another software (frequently, social networking such as Skype). Try to configure the port; use a free port number (for example, 81).

      sample screen to configure the port number


Stop the servers

On the  Manage Servers  screen of the XAMPP manager / controller, select the server you wish to stop and then press the Stop button. Alternatively, you may press the Stop All button.

sample screen to stop the servers

Be sure to stop the servers after you are done. Leaving the servers running consumes energy and may later prevent the servers from starting (in particular, MySQL server).


Copyright © 2022 Upsorn Praphamontripong

Released under the Creative Commons License CC-BY-NC-SA 4.0 license.

Last updated 2022-05-22 12:27