Some of you may have an idea of what the title means and some of you may not, so before we get into this tutorial let’s get fully acquainted with all the terms.
Apache is the most used web server software at the moment, and has been for the last 20+ years since its initial release back in 1995. It processes HTTP requests and allow us to store, process and deliver web pages locally or on the internet. All websites require a web server to be able to be displayed in a web browser.
PHP is a server-side scripting language. PHP can run locally, by itself, but it is most commonly known running as an extension to a web server. In this case it allows a developer to run a PHP application on the server and deliver the result through a browser. This is one of the most popular server-side scripting languages.
MySQL is a database server application that enables us to store and deliver data for applications and/or websites. MySQL has been the standard in open source database software for many years. But since its purchase by Sun Microsystems back in 2008, and sold again to Oracle in 2010, the original founders considered that it drifted away from its open source nature to a more commercial version. In reply to this, the founders of MySQL forked the source code and created MariaDB, a drop-in replacement for MySQL that promises to always remain open-source and compatible with MySQL API’s and commands.
If we put together all of the above information we should then get a web server (Apache) capable of handling a server-side scripting language (PHP) and the possibility to store information using a database server (MariaDB).
Each of the pieces of software described in this article is available for free and can be downloaded from their dedicated websites or authorized mirrors. The problem is that manual configuration can take some time and requires some advanced computer/server knowledge to understand what each option does.
Fortunately there a lot of alternatives, and one of them is XAMPP. This allows us to easily install Apache, MySQL/MariaDB and PHP by configuring them automatically during installation. It also includes additional packages like FileZilla FTP Server, Mercury Mail Server, Tomcat, PERL, phpMyAdmin and Webalizer. Basically everything you need to start your own web server for testing and development.
What you’ll need:
- a PC with Microsoft Windows
- an internet connection to download the installer
1. What you have to do is head over to www.apachefriends.org and download the installer. Note that XAMPP is also available for Linux and Mac OS X based machines so download the correct version for your OS.
2. Install XAMPP using the downloaded installer. Note that during installation you will be asked to choose the packages you need. Here you can uncheck everything except Apache, MySQL and PHP, but I do recommend that you also install phpMyAdmin and Webalizer. These will help you manage your MySQL databases and also provide information about website usage.
3. After installation you will be greeted by the XAMPP Control Panel. This is where you can start and stop the server applications and make modifications to their configuration files. To start Apache and MySQL just press the Start buttons for each of them.
4. Once the servers are started, open your favorite browser and point it to http://18.104.22.168 or http://localhost to access the XAMPP main page. From here you can access phpMyAdmin, view the PHP configuration using PHPInfo and also access a frequently asked questions section and a HOW-TO section that should be enough to get you started with XAMPP.
Congratulations! You have installed Apache, PHP and MySQL/MariaDB on a Windows machine using XAMPP. You can now test and develop websites by running them locally instead of having to uploaded each file to a web server after editing it.
NOTE 1: In order to access a website or script using XAMPP, you’ll have to move the website files to a folder called HTDOCS located inside the XAMPP installation folder (usually C:\XAMPP).
NOTE 2: Ports 80 and 443, used by default by Apache, may be blocked or reserved on your machine by other applications. For example Skype reserves these ports in case others aren’t available, and continues to reserve them even though it doesn’t use them. You can disable this in Skype by unchecking Use port 80 and 443 for additional incoming connections under Tools -> Options -> Advanced -> Connection.
NOTE 3: If your machine is behind a router and want to access the websites hosted on XAMPP from an external connection you’ll have to setup port forward on the router to the XAMPP machine for ports 80 (HTTP), 443 (HTTPS) and 3306 (MySQL).
If you have any other questions please use the comment section below.