webserver with php on home computer

Before we go on with the tutorial first let us see why would someone wants to start a webserver on his home computer:

  1. learn PHP and some other programming languages
  2. If you have a unique IP address you can begin your own site from your house
  3. To get used with Forum, blog, Photo sharing and other softwares before uploading them on net
  4. To test the themes available for the above programs

webserver with php on home computer

You can separately setup Apache, MYSQL, PHP but you should then make lot of changes to php configuration file to set all of them working together. That’s absolutely unnecessary for those who want to start a webserver to learn server-side scripting languages or start a website/discussion forum over the LAN network. Why should we beat our brain on editing php.ini file when every thing is ready and we can easily avail that?

We can get Apache, PHP and MYSQL as a single package in XAMPP and they are all configured you need not modify the php.ini file.Download XAMPP from the links given below

You can find very clear instructions to install XAMPP in their website i am adding the instructions on their site to install xampp on windows

Setup XAMPP on a Windows machine:

Method A: Easy One:
Using the installer version is the easiest way to install XAMPP.

After the setup gets completed, you will find XAMPP under Start / Programs / XAMPP. You can use the XAMPP Control Panel to start/stop all server and also install/uninstall services.

The XAMPP control panel for start/stop Apache, MySQL, FileZilla & Mercury or install these server as services

Method B: “Setup” without the Installer

Download and unzip the 7-zip or zip archives into the folder of your choice.

In this case, we unpacked XAMPP to D:Program Files and will get a D:Program FilesXAMPP folder. Next, open the XAMPP folder and run the “setup-xampp.bat” file.

All paths in the configuration will be updated.

Finally, start the different servers with the existing start/stop batch files or use the GUI version “xampp-control.exe”.

Note: If you work with the Installer version of XAMPP, you do not need to execute “setup_xampp.bat”.

How To Start XAMPP Without Setup?

If you extract XAMPP in a top level folder like c:xampp or d:xampp etc., you can start XAMPP directly. That means you do not need to execute the “setup_xampp.bat” at all. Apache, MySQL and Mercury Mail server will start-up correctly! FileZilla FTP server will not start because it requires absolute paths. Please note: Do not use a double-xampp-folder like c:xamppxampp! You need a single-xampp folder like d:xampp(apache and so on). Otherwise you must run the “setup-xampp.bat” to set up the path configurations.

The Practice:

Practice 1: Start, stop & test XAMPP

The universal control center is the XAMPP Control from www.nat32.com which is not included in the Lite version.


Some more server scripts:
Apache & MySQL start: .xamppxampp_start.exe
Apache & MySQL stop: .xamppxampp_stop.exe
Apache start: .xamppapache_start.bat
Apache stop: .xamppapache_stop.bat
MySQL start: .xamppmysql_start.bat
MySQL stop: .xamppmysql_stop.bat
Mercury Mailserver start: .xamppmercury_start.bat
(Mercury only GUI. Stop with GUI)
FileZilla Server setup: .xamppfilezilla_setup.bat
FileZilla Server start: .xamppfilezilla_start.bat
FileZilla Server stop: .xamppfilezilla_stop.bat

Test: After Apache starts, open the URL http://localhost or and examine all of the XAMPP examples and tools.

Practice 2: Installing a particular server as a service

ou can install one of the servers as a service under these platforms: NT4, 2000 and XP. You can use these scripts:

Apache Dienst install: .xamppapacheapache_installservice.bat
Apache Dienst uninstall: .xamppapacheapache_uninstallservice.bat
MySQL Dienst install: .xamppmysqlmysql_installservice.bat
MySQL Dienst uninstall: .xamppmysqlmysql_uninstallservice.bat
FileZilla Dienst (un)install: .xamppfilezilla_setup.bat
Mercury: No service installation available!

Practice 3: Setup Add ons

Many additional add ons exist for the development with the main package. At the moment, the official add ons for Win32 from this side are:

  • Perl Add-on with Mod_Perl and a selection important Perl Modules
  • Tomcat Add-on (Requirement: SUN J2SE SDK must already be installed)
  • Cocoon for Tomcat Add-on (Requirement: Tomcat Add-on must already be installed)
  • Python Add-on

The recommended rule for the setup is this: The XAMPP Installer version needs the Installer Add-on, the ZIP (7-Zip) package needs the ZIP (7-Zip) Add-on. For the ZIP Add-on please unpack the package into the XAMPP main directory directly. Afterwards execute the “setup_xampp.bat”. That’s all. Installer Add-on package makes everything automatically. There is nothing to do.

Note: Everyone can build a new XAMPP Add-on for his project. For example you will find some other add-ons for XAMPP at  http://sourceforge.net/projects/xamppaddon.

Practice 4: The XAMPP upgrades

When individual components of the XAMPP collection are upgraded, we will bring XAMPP up to date as well. However, some developments are not compatible to our last release and so we cannot upgrade these elements. Usually we are able to update all servers and programmes in XAMPP. NOT the configuration files because you could have modified them. Tip: If you have the installer version it is much easier to use the installer upgrade. All others should take the (7-)ZIP archive. Extract that package in the XAMPP folder directly and overwrite the older files.

Security (Must Read):

The XAMPP Security console

As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. XAMPP is configured is to be as open as possible and to allow the web developer anything he/she wants. For development environments this is great but in a production environment it could be fatal. Here a list of missing security in XAMPP:

  • The MySQL administrator (root) has no password.
  • The MySQL daemon is accessible via network.
  • PhpMyAdmin is accessible via network.
  • Examples are accessible via network.
  • The user of Mercury and FileZilla are known.

Please secure XAMPP before publishing anything online. A firewall or an external router are only sufficient for low levels of security. For slightly more security, you can run the “XAMPP Security console” and assign passwords.

To fix the most important of the security weaknesses simply call the following URL (access only from localhost):

Before version 1.4.15:

Since version 1.4.15:

The root password for MySQL, PhpMyAdmin, and also a XAMPP directory protection can be established here. For Mercury and FileZilla, please remember to change the configuration settings (e.g. user and passwords). Or if you do not need any of these servers, simply do not start them — That is secure, too.

How To Uninstall?

Method A: The Installer version

If you installed with the Installer version, please use the Uninstaller! The Uninstaller will delete all XAMPP entries from your registry and it will uninstall some installed services included with XAMPP. We highly recommend that you use the Uninstall program for removing XAMPPsetups from the Installer version.

Method B: Setup from ZIP and 7-ZIP package

Shut down the XAMPP server and exit all panels. If you installed any services, shut them down too.

To uninstall XAMPP that was installed from ZIP packages, simply delete the entire folder where XAMPP is installed. There are no registry entries and no environment variables to clean up… just simply good, clean code! Don’t forget to uninstall any services you might have installed.

Frequently Asked Questions:

Question 1: What is the “Lite” version of XAMPP?

XAMPP Lite (means “light” as in “light-weight”) is a smaller bundle of XAMPP components, which is recommended for quick work using only PHP and MySQL. Some servers or tools such as Mercury Mail and FileZilla FTP are missing in the Lite version. Additionally, there are no Install Shield versions, add-ons or upgrades for the Lite version.

Question 2: Where should I place my web content?

The main folder for all WWW documents is at xampphtdocs. If you put a test.html file here you can browse for it at http://localhost/test.html (if Apache server is running). Use the same procedure with all PHP or cgi files. You can create subfolders for your content too. For example, create the folder xampphtdocsnew and copy your test.html file there. Then enter the URL http://localhost/new/test.html to view this in your browser.

Further file characteristics in the overview:

  • CGI – Executable: Overall, Allowed endings: .cgi => base package
  • PHP – Executable: Overall, Allowed endings: .php .php4 .php3 .phtml => base package
  • MOD Perl – Executable: .xampphtdocsmodperl, Allowed endings: .pl => Perl addon
  • ASP Perl – Executable: .xampphtdocsmodperlasp, Allowed endings: .asp => Perl Addon
  • JSP Java – Executable: .xampptomcatwebappsjava (u.a), Allowed endings: .jsp => Tomcat addon
  • Servlets Java – Executable: .xampptomcatwebappsjava (u.a), Allowed endings: .html (u.a) => Tomcat addon
  • MOD Python – Executable: .xampphtdocspython, Allowed endings: .py => Python addon Spyce Python – Executable: .xampphtdocspython, Allowed endings: .spy => Python addon

Question 3: Can I move the XAMPP installation?

Yes, but only if you installed it using the ZIP (z-zip) archive method. After moving the XAMPP package, you must execute the “setup-xampp.bat” to update all configuration files. In this case you can make a copy of XAMPP and put this in a directory somewhere. At last execute the “setup-xampp” and make your tests. Try it out. If you installed with the Installer, then you must completely uninstall XAMPP and reinstall it at the new location. This is the only way to ensure that all changes made to the registry are cleaned up, and updated for the new location.

Question 4: How can I generate “automatic start sites” or default start pages?

If you browse to a folder like http://localhost/xampp/ the Apache server will return a start site automatically. The Apache server looks for a start page for your site, such as index.html or index.php. This is configurable from the “DirectoryIndex” directive in the httpd.conf file. Here you can define the names and the arrangement for your start sites. In XAMPP the “DirectoryIndex” directive list is as follows:

index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.html.var index.phtml

Question 5: How can I switch between PHP5 and PHP4 and back?

XAMPP (not Lite!) contains both PHP5 and PHP4. To switch between the versions please use the “php-switch.bat” ($path-to-xamppxamppphp-switch.bat). NOTE: The Apache server must be stopped before you make these changes.

Question 6: Where can I change the configuration?

You adjust XAMPP settings with plain-text configuration files. The following files exist:

  • Apache basic configuration: .xamppapacheconfhttpd.conf
  • Apache SSL: .xamppapacheconfssl.conf
  • Apache Perl (only addon): .xamppapacheconfperl.conf
  • Apache Tomcat (only addon): .xamppapacheconfjava.conf
  • Apache Python (only addon): .xamppapacheconfpython.conf
  • PHP: .xamppapacheconfphp.ini
    (with the apache actually running php version)
  • MySQL: .xamppmysqlbinmy.cnf
  • phpMyAdmin: .xamppphpMyAdminconfig.inc.php
  • FileZilla FTP: .xamppFileZillaFTPFileZilla Server.xml
  • Mercury Mail basic configuration: .xamppMercuryMailMERCURY.INI
  • Sendmail: .xamppsendmailsendmail.ini

Question 7: Do I have to go online to work with XAMPP?

No! You can work “offline” with XAMPP. In other words, you do NOT have to be connected to the Internet, because your own computer will provide all the hosting and serving features.

Question 8: Where is what?

Directory Content

XAMPP and services

For all NT/2000 users, in both packages you will find the install and uninstall files to build all servers as services in the respective directories.

  • apache_installservice.bat => Apache install as service/li>
  • apache_uninstallservice.bat => Apache uninstall as service
  • mysql_installservice.bat => MySQL install as service
  • mysql_uninstallservice.bat => MySQL uninstall as service

After all changes don’t forget to restart your system. Note! To uninstall the mysql service you must first of all have stopped the mysql service!


MySQL starts without a password for “root”. So in PHP you can connect the MySQL-Server with: mysql_connect(“localhost”,”root”,””);
If you want to set a password for “root” in MySQL, please use “mysqladmin” under Console. For example:

…xamppmysqlbinmysqladmin -u root password secret

Attention: After changing the password for root, don’t forget to inform PHPMyAdmin. Search the “config.inc.php” under …xamppphpmyadmin and edit the following lines:

$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL SuperUser
$cfg[‘Servers’][$i][‘auth_type’] = ‘http’; // HTTP MySQL authentication

Now the correct password for “root” is required, before PHPMyAdmin starts.

7 thoughts on “Start a Webserver with PHP and MYSQL support on your home Computer

  • August 2, 2011 at 1:13 pm

    Is it possible to run XAMPP from network drive? And is it possible to have multiple users for that one XAMPP that has been installed to network harddisk? (I mean that is it possible that 4 person / differnet computers are using this one XAMPP thru intranet network?)

    I’m trying to find this out because we want to get one xampp installed for our network drive in our class. Lets say its not possible to install xampp into every computer.
    Apache server and Mysql needed to get to work thru network drive.
    Our OS in our school is WIN 7

    start own xampp other lan pc exp: Pc1 – pc2- pc3

    plz help mein

  • April 21, 2009 at 3:49 pm

    i have xampp installed and running right. next question is how do i point my domain to my computer? i tried entering my ip as my name server lol

  • March 1, 2009 at 10:08 pm

    i just wanted to say that I love this site

  • May 10, 2008 at 6:39 am

    Hi pSouper
    Im glad that you liked this post.
    To setup a small network in your home,office or hostel you need some additional hardware like a hub or a network card.
    check this for more details

    If you are already have a Local Area Network (LAN) setup then you can host any number of sites on pc1.
    for example if your local ip is and you have three sites each in the directory


    then these sites can be accessed by pc2 and pc3 by the following urls

    You can give an ftp account to these directories to the person who will be developing this site

    I hope this helps, if this is not what you asking please let me know.

    Satish Gandham

  • May 9, 2008 at 9:56 am

    Hi guys, very simple instructions very well received – thanks.
    I would like to see this help extended to setting up an intranet / develop over LAN so that your readers (inc me) would be able to host xampp on a ‘server’ then view the sites for networked computers on the LAN.
    pc1 has xampp (and all the client sites in htdocs/www/domain1 & domain2 & domain3 etc)
    pc2 & pc3 etc are other pc’s on the network where these sites are developed.

    pc2 & pc3 would need to view these sites via http://localhost/domain1 & domain2 etc..

    would this prove helpful to others here too?

    kind regards,

  • October 27, 2007 at 11:31 am

    I want to learn PHP. This site looks like it’s going to make my life a lot easier. If it doesn’t I’ll be back to give this a thumbs down 🙂 From the site: Many people know from their own experience that it’s not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start. UPDATE: Was as easy as promised (simply extract to the specified directory and… um… thats it!) 🙂 Thanks


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.