PHP Development Simplified: A Step-by-Step Guide with XAMPP

Dharshitha Senevirathne
3 min readMar 27, 2024

--

XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB database, and interpreters for scripts written in the PHP and Perl programming languages. XAMPP stands for Cross-platform, Apache, MariaDB/MySQL, PHP, and Perl.

  • X = Cross-platform
  • A = Apache Server
  • M = MariaDB
  • P = PHP
  • P = Perl
XAMPP

Installing XAMPP

To install XAMPP, download the installer from the official website (Apache friends) and run it. Follow the on-screen instructions to select components and installation directory. Once installed, you can start the XAMPP Control Panel to manage your Apache server, MySQL database, and other components.

Open XAMPP and run Apache and MySQL services.

Configuring PHP: PHP configuration settings can be found in the php.ini file located in the php directory within your XAMPP installation. You can edit this file to change settings such as error_reporting, display_errors, and extension_dir. Remember to restart Apache after making changes to php.ini.

How to Run a PHP Code Using XAMPP?

To run a PHP script, create a new file with a .php extension in the htdocs directory within your XAMPP installation directory.

my_script.php

For example, C:\xampp\htdocs\my_script.php on Windows or /Applications/XAMPP/htdocs/my_script.php on macOS. You can then access the script through your web browser at http://localhost/my_script.php.

<?php
echo "Hello";
?>

Managing Databases with phpMyAdmin

phpMyAdmin is accessible through http://localhost/phpmyadmin and provides a graphical interface for managing your MySQL databases. You can create databases, tables, execute SQL queries, and perform other database-related tasks using phpMyAdmin.

MySQL

From here you can and manage create your own MySQL databases.

phpMyAdmin

Alternatives (WAMP)

WAMP stands for Windows, Apache, MySQL, and PHP, and it is a software stack for Windows operating systems that includes Apache web server, MySQL database, and PHP programming language. Similar to XAMPP, WAMP provides a convenient way to set up a local web development environment on a Windows machine.

WAMP
XAMPP vs WAMP

--

--

Dharshitha Senevirathne

My articles will help folks interested in software engineering, data science, and cloud technologies.