How to connect PHP to XAMpp Apache

PHP and Apache with XAMPP

easy installation of PHP, Apache and MySQL

XAMPP is available for Windows, Linux and Max OS X and is free of charge.

Download from:
and select your operating system there. XAMPP runs smoothly on Windows, Linux, OS X.

Take the ZIP version. The following instructions are written for the ZIP version.

second video:

After downloading you will have the file as a ZIP:

Right mouse button to unzip the file

A folder is suggested - you should definitely use a different one (see picture after next)!

Unzip XAMPP Light directly to c: \ (or, if you want, to your hard disk d: \).

The unpacking routine creates a subdirectory itself (so don't worry that you will have a confusing main directory afterwards).

Now all files will be extracted.

Under C: \ you now have a directory c: \ xampplite

It is important that this directory comes directly under root, otherwise there will be problems starting the Apache server!

There is an xampp-controll.exe in the c: \ xampplite directory

If this is double-clicked, you will get a window in which the various programs can be started.

Ignore the *** WARNING: Directory mismatch ***

This error message is irrelevant - Apache and MySQL still run without any problems! If you want to change this, you will find the relevant information at

Let's start Apache now. After clicking on Start, "Apache is starting [Port 80]" appears in the output window and "Running" is highlighted in green next to the Apache.

If this disappears after a short time (5-10 seconds), you have a problem. Experience has shown that you have then not installed XAMPPlite directly in the main directory.

Check whether you are really in the directory c: \ xampplite or d: \ xampplite. C: \ xampplite \ xampp-control.exe is then started

Another cause of problems can be that other software is using port 80. Skype likes to be one of these candidates. It is best to change the port there.

To check the required ports there is the program "xampp-portcheck.exe" in the XAMPPlite directory. The following picture appears when all ports are free and can therefore be used by XAMPP-Lite without any problems.

To test the XAMPP installation

To test the installation, start a browser and then enter “localhost” as the URL.

The following picture appears:

The Apache web server works and the XAMPPlite interface starts. You can select the language and see the administration interface.

Under Status you can again check which services are running (so far we have only installed the Apache web server, which also contains PHP).

If we also want MySQL, we also have to start this in the XAMPP Controll. MySQL is not yet important for getting started with PHP (later for databases).

Where are the PHP files stored?

It is very important that PHP programs that you have created yourself are saved in the htdocs directory. Otherwise the PHP commands will not be executed.

If we look at what is in the directory c: \ xampplite \ htdocs, we find an index.php there

This index.php is called automatically when we enter localhost (that is, this is our XAMPPlite administration program). So if we enter “localhost” in the browser, the directory c: \ xampplite \ htdocs will be looked up.

Therefore, all PHP programs always belong in this directory or subdirectories.

For testing we now create a directory with the name "first test"

In this directory we save a file with the name "hallo.php". The content of the file is:

With the Windows editor you have to make sure that you put the file name "hello.php" in quotation marks when saving. Otherwise the editor will add a .txt to the file name and the finished file will be called "hello.php.txt" and will not be recognized by Apache as a PHP file!

And now we enter in the browser: http: //localhost/erstertest/hallo.php

The individual components:

  • http: // localhost / our local web server on your own computer
  • first test / the directory that is located in the XAMPP directory under htdocs
  • hello.php our first PHP program

The output "Hello World" should now appear in the browser with the current time - the installation worked - a good start


To quit XAMPP, stop the programs that have already started and then go to Exit.

If the XAMPP Control Panel is not visible, you will find the symbol in the task bar at the bottom right:

Double click and you get the XAMPP Control Panel.

Alternatives to XAMPP

WAMP5 - - French, English website with Apache, PHP and MySQL out-of-the-box package.

If you find a bug, please let us know (no matter if typographical or content-related error).

With a mouse Mark the faulty point and take over with the following button:

After submitting it comes feedback! Please do not send twice. Thanks.