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 let me know if you find any errors or omissions in the document —Upsorn Praphamontripong, 12-September-2023)

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 the XAMPP version that supports PHP 7/8 (GCP currently supports PHP 7.2, 7.3, 7.4, 8.1, and 8.2).

    Apache main page

    Mac full version vs. VM version

    For Mac users, you may need to move mouse over the Download button (above) to verify the version from the file name. The full versions have names ending with "-installer.dmg" while the VM versions have names ending with "-vm.dmg." Usually, the full versions are the top three.

    If a VM version is used, you need to mount it. When you access the environment, you need to use an IP address (obtained when you mount it) instead of "localhost." Please refer to https://www.apachefriends.org/faq_stackman.html for XAMPP-VM FAQ.

  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 Parul Goswami)

      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 © 2023 Upsorn Praphamontripong

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

Last updated 2023-09-12 8:37