Installing XAMPP – Apache Server, MySql, and PHP

These instructions are for installing XAMPP 1.7.3 on Windows XP, Service Pack 3. It should work for other configurations as well.

XAMPP 1.7.4 (released in January 2011). I had no problem with the install and most things work just fine, however, there are many little things that require “expert” tinkering to get it working right. Because of this, I cannot recommend it to someone just looking for a straightforward install with minimal tinkering. See also this discussion thread at Apache Friends which covers in more detail the various issues.

XAMPP 1.7.7 (released in Septemeber 2011) is the latest version. I had no problem with the install and most things work just fine, however, there are many little things that require “expert” tinkering to get it working right (it is much stricter on PHP errors than 1.7.3 is – a flag change to fix that). Because of this, I cannot recommend it to someone just looking for a straightforward install with minimal tinkering. It has a new phpmyadmin interface (unfortunately, it defaults to German – easily changed, though). It still exludes the port checker present in version 1.7.3 (which is a really useful debug tool).

If you are determined to install XAMPP 1.7.4 or 1.7.7 and you are more of a user than a developer, you will want to check out this article on preventing the PHP interpreter from spitting out error messages related to poor programming practice (yes, even popular packages can be filled with poor programming practices) and deprecated features.

NOTE: If you are just looking for a way to install and test various web applications. A simpler alternative might be to install AMPPS instead. It provides the same basic functionality as XAMPP, but includes installation scripts for over 200 different web applications. You can read about installing AMPPS here.

Click on images for full sized versions.

XAMPP is an extremely easy to install and use Apache Server which comes bundled with MySQL (a database), PHP (server side scripting language), Perl (another server side scripting language), FileZilla FTP Server and Mercury Mail Transport System.

Why would I want to install it?

To allow development and testing on your local machine instead of on a remote (and probably live) server. I use it to test out changes to my website before uploading and committing changes to the real site.

Installation

Download the self extracting package, run it and, in most cases, accept the default settings.

Downloading

1) Go to the SourceForge website and select xampp-win32-1.7.3.exe to download XAMP (this is the self extracting version with the built-in installer):

xampp-1.7.3-1-download

2) You will be redirected to a download page. If the download does not start in a few seconds, click on the direct download link:

xampp-1.7.3-1-download-2

3) Select to either Save the file or to Run it directly over the Internet. Saving allows you to uninstall and reinstall if necessary:

xampp-download-4

Extracting

4)  Enter the location to extract XAMPP into. By default, it selects the C:\ drive. I entered my D:\ drive because I have more space there. [NOTE: XAMPP will automatically create a folder called \XAMPP in the directory you specify, having C:\ as your install folder will result in XAMPP being installed in C:\XAMPP\]. Click on the Install button:

xampp-extraction-1

Configuring

The XAMPP installation will ask a few configuration questions. It should be safe to accept the defaults.

5) Enter y and press the Enter / Return key for the prompt: Should I add shortcuts to the startmenu/desktop? (y/n): y

xampp-install-question-1

6) Enter y and press the Enter / Return key for the prompt:

Should I locate the XAMPP paths correctly?

Should I proceed? (y/x=exit setup): y

xampp-install-question-2

7) Enter n and press the Enter / Return key for the prompt:

Should I make a portable XAMPP without drive letters?

NOTE: – You should use drive letters, if you want use services.
      – With USB sticks you must not use drive letters.

Your choice? (y/n): n

xampp-install-question-3

8) Press the Enter / Return key for the prompt:

XAMPP is ready to use.

Press to continue:

xampp-install-question-4

9) Press the Enter / Return key for the prompt:

I have set the timezone in ‘php.ini’ and ‘my.ini’ to “America/New_York”.

You should correct these values if my guess was wrong.

Press to continue:

xampp-install-question-5

10) Enter 1 and press the Enter / Return key for the prompt: Please choose (1-7/x): 1. This will start the XAMPP control panel:

xampp-install-question-6

Setting Up

11) Click the two check boxes labelled Svc located next to the Apache and MySQL labels. This will install both services for you:

xampp-main-panel

12) Press OK when prompted to install the Apache Service and MySQL service:

xampp-install-apache-service-prompt

xampp-install-mysql-prompt

13) Observe that the services are now running. If the services are not running, then you need to manually start them. See step (14).

xampp-main-panel-services-running

14) If the Apache and MySql services did not start when you installed them, then click on the Start button beside each service. NOTE: The Apache service can take several seconds to start and the application may look as though it is hung – just wait. If the Apache service does not start, see Troubleshooting below.

xampp-1.7.3-start-services

Testing The Installation

XAMPP is now setup and ready to use on your computer.

To test, launch your browser and enter:

http://localhost

into your navigation bar. You should see the following display:

xampp-successful-install-welcome-screen

The default installation of XAMPP Is not secure and should not be used as a publicly accessible server. However, it functions just fine as a test bed server for various software packages like Joomla!, WordPress, Drupal, or even if you want to experiment with PHP or MySQL.

When you set up a web site under XAMPP, you need to type localhost/my-site into the navigation bar to access it. If you would like to change it so you can type my-site.com instead (so it looks more like a “real” web site), you can find instructions for that here.

Troubleshooting

Sometimes the Apache Server will not run. This is most often caused by some other application using port 80 (the http port).

If you are not allowed to change or disable programs using port 80, or if port 80 is being blocked on your computer, consider changing the port the Apache Server uses.

Instructions for changing the port used by Apache Server are found here.

1) Click on Port-Check to see if any other applications or services are using port 80.

xampp-1.7.3-port-check-1

2) A console window will appear and XAMPP PortCheck will run. Sample results are shown in the image below. In this case, uTorrent is using port 80 and preventing Apache Server from running. The solution is to either shutdown uTorrent or change its configuration to use a different port.

xampp-1.7.3-port-check-2

The more common cause is that Microsoft Internet Information Services (IIS) is running. Instructions for disabling the IIS can be found here.

23 Comments

  • kashan says:

    Useful information for xampp installing and troubleshooting

  • Rahul Kashyyap says:

    hello sir your site information very good and useful site but
    i need your help plz tell me “how to access my one xampp my lan computer exp:
    install xampp pc1 and how can access other lan computer Pc2 and pc3
    plz help me i hope you help me
    thanks

    • admin says:

      As far as I know, what you need to do is:
      (1) set up a network in which all your computers are connected. You seem to have already done this since you indicate you have a network with 3 PCs.
      (2) Determine the IP addresses of the computer running XAMPP. The IP address assignment is very likely done by your router / switch / hub. You want to ensure that you have static IP addresses, rather than dynamic ones.
      (3) once you know the IP address of the computer running XAMPP, you can access it by typing the IP followed by any necessary path info into the URL bar of a browser on any of the other computers.
      Example:
      Suppose the machine running XAMPP has an IP address of 192.168.1.34.
      From the other machine, you would type 192.168.1.34 into the URL field, followed by wahatever path is needed to your site content (say /my-site).
      192.168.1.34/my-site
      You also might want to secure your XAMPP install. Type /localhost/security into the URL field on your XAMPP machine and see what is open and what isn’t. Then click on the http://localhost/security/xamppsecurity.php to fix thos security issues (or you can just type that field in directly).
      Hope this gives you enough info to resolve your problem.

      • rahul kashyap says:

        thanks admin,
        but this not working
        plz solve my problem

        • admin says:

          Solving your problem is a little hard because I don’t have access to your computer, however, we can work together to try and resolve this.
          First, what is not working? You installed XAMPP and when you go to your browser you get a page not found error?
          The most common cause is that the Apache Server is not running. The two most common causes of the Apache Server not running are:
          (1) you did not install the Apache Service and Start it (see steps 11-14).
          (2) something is preventing the Apache Server from running. Usually, this is some other application binding to port 80 and or port 443. Most commonly, this is Windows IIS.
          If you installed XAMPP 1.7.3, you can click on Port Check and see if another program is using those ports. See the troubleshooting section at the bottom of the page.
          If you installed some other version of XAMPP, then you need to use a 3rd party application to check your ports.
          See these articles for troubleshooting:
          Troubleshooting the Apache Server Not Starting
          Disabling the Microsoft Internet Information Server (IIS)
          If Apache is running on your local machine and you are having problems accessing it across the network then we have to look at your network setup:
          (1) do the computers see each other across the network?
          (2) can you move files from one computer to another using Windows?
          (3) if you ping the remote server from a computer in the network, do you get a response?
          Unfortunately, I have not set up a networked system where I run XAMPP on one computer and try to access it from another. And, at the moment, I have no intent of doing so, since I only use XAMPP for local testing (though, I may try this in the future).
          You might get more and better help from an Apache forum where someone else has done the same thing you are trying to do.
          See the bottom of this page.
          You might also check out the following:
          Can’t start Apache with mapped network drive – the solution seems to be to use UNC path instead of mapped drive.
          Alias network drive Apache Server – the solution is the same as above, use a UNC path
          Using Apache over a Local Network – the solution provided here is to edit your hosts file to map domain names to IP addresses (in this case, the IP address of the Apache Server.
          Accessing XAMPP Over a Network – here they recommend checking that Apache is listening to port 80, not 127.0.0.1:80. This requires modifying the httpd configuration files.
          Unable to connect Apache over LAN – some good network troubleshooting tips.
          You have to ensure that the computers in the network always get the same IP address. If the IP addresses are dynamically assigned, then they might change from one boot to another.
          Make sure there are no firewalls blocking access among the computers. Firewalls may be present on the computer itself or in the router.
          A third possible reason is that your IT department (assuming this is at work) blocks those ports or blocks those applications from running.
          Hope this gives you something to go on.

  • Josh Nigam says:

    You have articulated the entire concept in a nice and neat fashion.. especially the areas which need troubleshooting … keep us posted with other vital info… 🙂

    • admin says:

      Thank you very much for your comment.
      I am always open to suggestions for other articles … but I am not making any promises.

  • Ganesh says:

    Good information.helped me a lot.

  • BoBo says:

    Hello sir, I need your help. I have installed the XAMPP 1.7.3. Both the Apache and mysql cannot run. The port-check shows that their ports are free ( Apache 80 and mysql 3306).
    What can I do to fix it?
    Thank you.

    • admin says:

      If port 80 and 3306 are free, the only four things I can think of are:
      (1) if port 443 is not free, this will prevent Apache from starting since it requires (at least in XAMPP) both 80 and 443 to be free (they correspond to the http and https ports respectively).
      (2) you have not started the Apache and MySQL services (there should be a green Running besides each after you click on the Start button You can install the service as well (though, this is should not be necessary – even if I include the step in my instructions above).
      (3) Windows Firewall (or some other firewall) are blocking those applications. You can check these two Microsoft pages: page 1, page 2. Also do a Google search on how to unblock a program being blocked by a firewall.
      (4) Apache and MySQL are blocked from running on your computer. Companies, sometimes block certain applications from running.

  • Akzorz says:

    How do you set the language for phpmyadmin and why is mysql still set to german as well…

    • admin says:

      My best guess on why it installed the German version is that Deutsch was selected during installation.
      This option is available for XAMPP 1.7.4 and 1.7.7. I can’t see any language option for XAMPP 1.7.3 – English seems to be the only choice.
      To change the language from German to English, try the following:
      1) Find the heading: Oberfläche
      2) Underneath that will be a line and dropdown box with the heading: Sprache – Language
      3) Click on the dropdown box and select English (or your language of choice)
      Hopefully, that will set your language back to English (or your language of choice).

  • Abhijith says:

    apache and mysql is not running i dont know why.can get a solution for that.

    • admin says:

      The likely problem is a port conlict.
      Port 80 and 443 are used by the Apache Server. If you are running Windows, you might has IIS installed and running. Check this tutorial for removing it. IIS is Microsofts version of a http server.
      Port 3306 is used by the MySQL database.
      If those ports are being used by another application, then Apache Server and MySQL will not run.
      Check out this tutorial on trouble shooting port conflicts.

  • Sarajane says:

    How can I see who has been logging in to Apache server including myself?

    • admin says:

      The Apache server log is a text file. You can find it in C:\xampp\apache\logs\access.log.
      There is a lot of data in it and it is quite raw.
      This tool might help with viewing the log. It claims to be free, but I have never used it, so I have no comment on it other than “I found it while googling”.
      I hope that answers your question.

  • joy says:

    I have installed mysite in my htdocs,,i also want to create another one,,is it ok to have to site in apache server?
    help me..
    thanks a lot

    • admin says:

      Yes, it is possible to have multiple website installed under xampp.
      The key is to put them into different folders under htdocs
      For example, let’s suppose you have 3 websites you want to play around with under XAMPP. We’ll call them, “My Cool Website”, “My Awesome Website”, and “My Rockin’ Website”.
      You can run all three under XAMPP as long as they are installed in different directories under htdocs. They can even be installed on different platforms (Joomla!, WordPress, Drupal, etc).
      To access them in a browser you would type: localhost/<folder name>
      Where
      folder name is the name of the folder you installed to. Please note – avoid spaces in your folder name.
      localhost maps to the htdocs folder. Any directories you put in htdocs can be accessed by just appending them to localhost.
      You don’t have to stop at one level of directory nesting – you can go deeper.
      It is perfectly valid to have something like this: htdocs\website\another_website\still_another
      Where you have a website at each subdirectory. You would access each one as follows:
      localhost/website
      localhost/website/another_website
      localhost/website/another_website/still_another
      Personally, I wouldn’t do it that way – I would keep all websites at the same level.
      THe only time I would create a website under another one is if one part of my website was powered by a different technology.
      For example, suppose I ran my main site on WordPress, but in addition to having articles and comments, I want a forum section where people can discuss things. I am sure WordPress has some sort of forum plugin, but I would prefer to go with a standalone application that is specifically design for forums. So I would install it in a subdirectory called forum:

      htdocs
      ------website_1
      ---------------forum
      ------website_2

      In this case, I have 3 websites installed under htdocs. Two at the same level and one a little deeper.
      I hope this answers your question and thanks for asking.
      (I apologise that comments need moderation, but I get way too much comment SPAM – even with filters.)

  • Atko says:

    Ăśdv Admin
    nekem az a gondom hogy apachhát-nem tudom be kacsolni a dila zila meg a másik futt

    • admin says:

      Én nem beszélek magyarul. A Google Translate, nem értem a megjegyzést. Bocsánat.
      Próbáld egyszer?bb magyar.
      Ha más nyelven beszél, akkor próbáljon meg angol, francia, spanyol, lengyel vagy.
      Angolból fordították a Google Translate.


      I don’t speak Hungarian. Using Google Translate, I cannot understand your comment. Sorry.
      Try simpler Hungarian.
      If you speak other languages, you can try English, French, Spanish, or Polish.
      Translated from English using Google Translate.