⇧
vadnica-logo
Editor My Blog Password Manager Finance My Services About the Project Telegram O meni O meni

XAMPP: Complete setup of a local development environment

XAMPP is not just a single program, but an entire stack that simulates a web server on your computer. The acronym XAMPP stands for: X (Cross-platform), Apache, MariaDB (MySQL), PHP, and Perl. Without this environment, your computer would not know how to interpret PHP code, as PHP requires a server-side processor to convert code into HTML that a browser can understand.

Step 1: Installation and Resolving System Conflicts

Download the latest version from Apache Friends. During the installation process, we encounter two critical points that beginners often overlook:

Security Warnings (UAC & Antivirus):
UAC (User Account Control): If you install XAMPP in C:\Program Files, Windows will restrict write permissions to folders (e.g., htdocs). This means you won't be able to save your PHP projects. Always install in C:\xampp. Antivirus: Some programs (e.g., Avast or Norton) block scripts during installation. If you receive a warning, confirm it, as XAMPP needs access to system ports.

Step 2: Control Panel Configuration

When you open the XAMPP Control Panel, you will see "Start" buttons next to each module. For development work, you need Apache (web server) and MySQL (database). Troubleshooting port conflicts (Port 80): If Apache does not turn green, port 80 is likely occupied (often by Skype or IIS). In this case, you must click on the Config -> Apache (httpd.conf) button and change the line Listen 80 to Listen 8080. Your address will then be localhost:8080.

Step 3: Professional MySQL Password Setup

Most breaches on local servers occur due to default settings. The root user initially has no password. To fix this, use the built-in terminal (Shell button):

C:\xampp> mysqladmin.exe -u root password your_new_password

After this command, any attempt to access the database will require authentication. This is crucial if your computer is used by multiple people or if you are testing web applications outside your local network.

Step 4: Where are your files? (htdocs)

Your PHP files must not be located just anywhere on your drive. The server can only see them in the C:\xampp\htdocs folder. Create each new project inside its own folder within htdocs (e.g., htdocs/my_website/).

Tip: Do not open PHP files with a double-click! Always access them via 
a browser at http://localhost/folder_name/file.php.

Step 5: phpMyAdmin and MySQL Admin

Use phpMyAdmin for visual table management. Here you can import SQL files, create new databases, and verify the queries you write in your PHP code.

Installation on Linux Systems (Ubuntu, Debian, Mint)

Installation on Linux differs from Windows, as everything is done via the terminal. The package for Linux (XAMPP for GNU/Linux) provides all the necessary tools, including the Apache web server and MariaDB database.

  1. Download the .run file from the official website.
  2. Open the terminal and navigate to the folder where the file was downloaded (usually Downloads).
  3. You must first grant execution permissions to the file using the command:
$ chmod +x xampp-linux-x64-installer.run

Then, run the installation with administrative privileges (sudo):

$ sudo ./xampp-linux-x64-installer.run

Starting and Managing on Linux

On Linux, XAMPP does not always have a desktop icon, so we manage it using the following commands:

Command Action Description
sudo /opt/lampp/lampp start Starts all XAMPP modules (Apache, MySQL, ProFTPD).
sudo /opt/lampp/lampp stop Safely stops all running services.
sudo /opt/lampp/lampp restart Restarts the server (useful after changing settings).
sudo /opt/lampp/manager-linux-x64.run Opens the graphical user interface (control panel) if you need it.
Important: Permissions in the htdocs folder
On Linux, the default folder /opt/lampp/htdocs is owned by the system user (root). To be able to create files there, you must change the ownership or permissions: sudo chmod -R 777 /opt/lampp/htdocs

Diagnostics and Support

If your server is still not working despite all steps, check the "Error Logs" (Logs button in XAMPP). The most common issue is Firewall blocks. If you get stuck, write to me – we will solve every error together.