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
- 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.
- 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
- 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.
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.
(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.
- Start the servers
- MySQL Database — for a database server
- Apache Web Server — for PHP environment
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).
- 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).
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.
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).