How to install Apache, PHP, and MySQL on Windows XP

So basically this is a rewrite of my previous guide but with a more proper method and beside you can find all the information you need on installing Apache, MySQL and PHP on a single page without going to another page unless you’re running Windows Vista / 7 of course

Anyway to make things short, let’s begin the guide on Installing Apache, PHP, and MySQL on Windows XP so i don’t waste your precious time ;)


Apache HTTP ServerDownload Apache – See the update right below this before downloading

PHP for WindowsDownload PHP – See the update right below this before downloading
Make sure to download the Thread Safe version

MySQLDownload MySQL
If you have slow connection you can use the Essential version to save your time :)

At the time i wrote this the latest version of Apache is 2.2.15, PHP 5.3.2, and MySQL 5.1.45


Because PHP no longer provide the PHP VC6 binary since version 5.3.6 directly on their website, there are two options for you to choose from:

1. Stick with PHP 5.3.5 VC6 and Apache binaries from official Apache website (the last version of PHP that is compiled using VC6) and can be downloaded from here. This is perhaps a preferred way if you’re just going to use it for development purpose or anything that is not really important

2. Use the VC9 version of PHP 5.3.6 or higher and Apache VC9 binaries built by

If you’re going with option 1 then you can just simply follow the guide above, but if you choose option 2, the easiest way to install it is:

1. Download Apache binary from and then download VC9 PHP from PHP website

2. Extract the apache into C:\ (so the apache directory ended up in C:\Apache2)

3. Open httpd.conf in C:\Apache2\conf and:

# Search for DocumentRoot "c:/Apache2/htdocs" and replace it with
DocumentRoot "c:/htdocs"

# Right above the DocumentRoot add ServerName

# Then search for Directory "c:/Apache2/htdocs" and replace it with
Directory "c:/htdocs"

# Then create a directory named htdocs in C drive

4. Now run command prompt as administrator and then type:

cd /d C:\Apache2\bin
httpd -k install

5. As for the rest (PHP and MySQL setup) you can follow the guide below :)

Installing Apache on Windows XP

1. Begin by running the apache installer until you reached this screen that prompt you to insert your Apache server information

Apache Server Information

2. Then when the installer asked you for the setup type, choose Typical

Apache Setup Type

3. And then when asked to choose the installation directory, make sure to use the default path as shown below (otherwise you’ll need to adjust everything else to match your Apache installation directory later)

Apache Install Path

4. And finally you’re done installing Apache. After installing Apache you would notice there’s a new icon installed on the System Tray (where the clock displayed in Windows), the new icon is called Apache Service Monitor, which is basically a tool to help you to Start/Stop/Restart Apache quickly and when you double click on it you’ll see this

Apache Service Monitor

Configuring PHP with Apache on Windows XP

1. Create a new directory named PHP5 in C:\ so it’ll end up like below image for an example (you’re free to use other path, but if you choose to put it in different path, make sure to adjust them accordingly because in this guide i assume the PHP is extracted to C:\PHP5)

Create PHP5 directory and extract PHP5 inside that directory

2. Locate php.ini-production in C:\PHP5 then rename it to php.ini

Rename php.ini-production to php.ini

3. Open php.ini and locate extension_dir directives, uncomment and change the value into


Change php extension_dir

4. Still with php.ini, next you need to find output_buffering and change it to

output_buffering = Off

Disable php output_buffering

5. Locate php_bz2.dll, php_mbstring.dll, php_mysql.dll, and php_mysqli.dll and uncomment it

Enable php_bz2, php_mbstring, php_mysql and php_mysqli extension

6. Now we are done with the php.ini configuration, the next step would be locating Apache httpd.conf (if you didn’t change the default Apache installation directory it can be found at C:\Program Files\Apache Software Foundation\Apache2.2\conf or C:\Apache2\conf\httpd.conf if you choose to use Apachelounge version)

Location httpd.conf

7. Open httpd.conf and uncomment expires_module, headers_module, rewrite_module and then add

LoadModule php5_module "c:/php5/php5apache2_2.dll"

Enable mod_expires, mod_headers, and mod_rewrite plus add php5 module

8. Still in httpd.conf, inside

<IfModule mime_module>


AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

PHP AddType

9. Still in httpd.conf once again, locate

<IfModule dir_module>
DirectoryIndex index.html

and replace with

<IfModule dir_module>
DirectoryIndex index.html index.htm index.php

httpd.conf DirectoryIndex

10. Now we’re done with httpd.conf the next step is opening System Properties (Windows Key + Pause/Break or by right clicking My Computer and then choose Properties) and then choose Advanced tab and finally click on Environment Variables

Environment Variables System Properties

11. Locate Path under System Variables and then double click on it then add



12. Still in Environment Variables, next you need to click New System Variables and then add

Variable name: PHPRC
Variable value: C:\PHP5

PHPRC System Variables

13. We’re finished with adding and editing System Variables, now go to C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and then create a new text file inside that directory named test.php and open it with notepad then add this

<?php phpinfo(); ?>

Create a test PHP

14. Now we’re done with the PHP Apache integration. Save your work and then restart your computer

15. Finally after finished booting into Windows XP, now open your favorite browser (in this example i use Internet Explorer 6 which is the default browser for a freshly installed Windows XP installation) and then type


Apache PHP Install done

And you’re done with Apache PHP integration process :) … the next step would be Installing MySQL on Windows XP

Installing MySQL on Windows XP

1. Run the MySQL Installer, then choose Typical setup type when asked to install it to default path

MySQL Typical Setup

2. And continue with the installation process

MySQL Installation Confirmation and Install Path

3. When you reached this screen after MySQL installation process finished, check Configure the MySQL Server Now and uncheck Register the MySQL Server now

Configure MySQL

4. When asked for the configuration type, choose Detailed

MySQL Detailed Configuration

5. Then choose Developer Machine as the server type to make sure MySQL doesn’t use too much memory (well if you have plenty of RAM then feel free to choose other server type to suit your needs)

MySQL Server Type

6. And then choose MultiFunctional Database when prompted

MySQL Database type Multifunctional Database

7. When asked for the InnoDB storage location, choose C:\MySQL InnoDB Datafiles\

MySQL InnoDB data path

8. And when asked for the max concurrent connection that MySQL would accept choose Decission Support (DSS)/OLAP (but if you think that you’re going to have many concurrent connection later especially if you’re running a popular WoW Private server then you can choose Manual Setting and choose what would be the best value for your application)

MySQL max concurrent connection

9. When you reached the MySQL networking options, just leave it at default value

MySQL networking options

10. As for the MySQL default character set, choose Best Support for Multilingualism to make UTF8 as the default charset

MySQL UTF8 Default Character Set

11. And then when you reached Windows options, don’t forget to check Include Bin Directory in Windows PATH so you can access MySQL easily from the command line

MySQL Include BIN Path

12. Now comes the most important part of the MySQL installation, and that is setting a root password for MySQL (root is the superuser in MySQL, make sure to remember root password and don’t give it to anyone else)

MySQL Set root password

13. Now you’re done installing MySQL

MySQL Installation and Configuration done

You’re done installing Apache 2.2, PHP 5.3 and MySQL 5.1 on your Windows XP computer. Hopefully you enjoy this quick guide and of course if i missed something, please do let me know in the comment area below :)

Note: Updated because the VC6 version for PHP 5.3 series is no longer listed on PHP website and replaced by VC9


Note: Comment may not appear right away.

72 comments on “How to install Apache, PHP, and MySQL on Windows XP

  1. I want to start off by first saying thank you for the great info on how to set everything up. Yet after reading and re-reading everything I am still having trouble with the http://localhost/test.php (it shows the error as everyone else is getting and if i just do http://localhost/(it pops up with the “it works!” message. Also I am unable to finish the MySQL install, it hangs on the “Apply security settings and I recieve an error ( Error Nr. 1045 access denied for user “[email protected]” (using password: Yes) I have been reading over and over so any help on this matter would be greatly appreciated.

    Msn- [email protected]

    1. Also to a note to the post, is that after restarting my computer Apache doesnt seem to be connected “Running none of 1 Apache services” and yet when i test the http://localhost/ it still says “It works!” I am really confused now and everything else is still the same. I am always on msn if anyone can help. I will greatly appreciate it.

    2. Paul, try typing this command at the command prompt to check whether you have multiple apache

      netstat -an | find /i "listening"

      If you see there’s a process listening at port 80 (indicated by xxxxx:80). You can then type

      netstat -abn

      to see which process name using that port so you can terminate it using the task manager or you can directly kill the process via the command prompt using this command

      taskkill /f /pid processid

      As for this error message from MySQL ( “Apply security settings and I recieve an error ( Error Nr. 1045 access denied for user “[email protected]” (using password: Yes) )

      It seems that you have previously installed MySQL and already set the root password so MySQL can’t apply the new security settings

      If you are sure that there’s no important data in your mysql database, then the easiest way to fix this is simply to delete the mysql data directory :)

      To see where mysql data directory located, you can open my.ini located in your mysql installation directory and locate this line:


      When you have located the data directory, you can just simply delete it (delete the actual directory not the line itself). And then continued by running the MySQL Instance Config application again :)

  2. Absolutely brilliantly set out! The step by step layout as well as accompanying pictures made what would have been a tedious process a lot easier. Thank you for you hard work and continued hard work!

  3. Everything is perfect, except for the MySQL Server Instance configuration. When I get to the final step, I click execute, it prepares the config and writes the file but it fails to Start Service. Any way I can fix this?

    1. mysql service refuses to start.
      instalation message is “could not start the service mysql51 =error 0
      even if i change server name doesnt make a difference

  4. This step could be useful after you have installed Apache:

    1) In order to allow access by http to your sever, you must Unblock the 80 port in your firewall.

  5. Found the error: I’ve downloaded the PHP installer instead of the zip file, thus I lacked a lot of files. I should have seen that on the steps that you are extracting, but at the prereq part of the tutorial you should note to download the zip and not the installer.

  6. I followed your instructions and I am currently stuck at testing PHP. My apache does not start. If I click on start it says “The requested operation failed”

    Any ideas?

  7. I didn’t think about your site reading the html, lol. What I get is a white page displaying what I entered on step #13.

    1. Could you try editing the php.ini file and locate display_errors and change the value from Off to On so you can see the error message. Because white page often caused by error in PHP (if you’re currently try to open PHP file on your browser) :)

    1. I figured out why I was getting a blank white screen after running the /localhost/test.php

      My test.php file was actually a text file and not a php. I had to tell windows to “show file extensions” and then noticed the file was actually named text.php.txt.

      I renamed it removing the .txt and everything worked!

    2. I figured out why I was getting a blank white screen after running the /localhost/test.php

      My test.php file was actually a text file and not a php. I had to tell windows to “show file extensions” and then noticed the file was actually named text.php.txt.

      I renamed it removing the .txt and everything worked!

      As reaper states in a post above:

      When saving the file using notepad, change the save as type to all files :)

      This will make it a test.php file instead of a test.php.txt file to begin with

  8. Stupid question but where it says:

    Locate php_bz2.dll, php_mbstring.dll, php_mysql.dll, and php_mysqli.dll and uncomment it

    What do you mean by uncomment it?

  9. As I realize that you are in a different time zone I wanted to thank you for posting this up. However I am having a problem with mysql. When I click execute it freezes and crashes do you know of a way to repair this?

    1. You’re welcome Kanos, and yes you’re correct that i live in different time zone :)

      And if the process hangs, have you tried running the mysql server instance config wizard from the start menu manually?

      If it’s still not working, try opening services.msc (from the windows run) and see whether MySQL service is listed there. If it’s already listed there try starting mysql service from the services page :)

  10. I am setting these up on an external hard disk.

    When I try the test, I get the following response

    Though the site seems valid, the browser was unable to establish a connection.

    * Could the site be temporarily unavailable? Try again later.
    * Are you unable to browse other sites? Check the computer’s network connection.
    * Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.

    I double checked to make sure that everything was as entered.

    Is it possible that the way I have the directory E:/Program Files/PHP5 is the problem? I am really clueless. Thanks for your help. Whenever it was required to put in a line with the path, that is the one I used, since that is where I installed it.

    1. No, actually even if you put php in different directory than the one listed in the example it should work just fine

      Try opening http://localhost first (without the test.php) assuming you didn’t change the document root in your httpd.conf, and see if you get It Works! message (which mean apache is working)

      If you didn’t get that message, that means apache process isn’t running

  11. Just add an “s” like this:
    AddType application/x-httpd-php-source .phps
    and everything should work after that point

    1. Thank you very much Jim, it seems that i forgot the add the s letter. And i have updated the post

  12. I think i see why that seems to help them…

    If you look at the Text:
    (AddType application/x-httpd-php-source .php)
    And the image shows:
    (AddType application/x-httpd-php-source .phps)

    1. Try opening httpd.conf and see whether Addtype for php has been set or not :)

  13. Noticed when I added

    “AddType application/x-httpd-php-source .php”

    PHP would not work. Removed and PHP worked fine. This was under step #8

    Everything else worked fine.

    1. Hm now that’s strange AddType is used in order to process the php so it can get parsed by the web server (in other words, not displaying the php source code)

      I have just tested it, if i choose to remove that part, php file will be displayed as it is (not parsed) which means the php source code is displayed in browser

    2. I tried the same as James (as I was having the same problem) and after removing that line everything works…