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. Dear Sir,
    The previous problem was solved but now when I want to open the test.php the browser alert me that the page can not be found,Http 404. do u know what is the problem now? thx

  2. Dear Sir,
    Unfortunately I followed the instruction but after compeleting install of PHP5 and reconfiguring the httpd config file an rebooting the apache engine would not start! now what shoould I do?
    please guide me.thx alot am looking foreward.

  3. Great blog, very concise. It aided me no end in installing all three applications and getting them up and running. keep up the good work.

  4. Great tutorial so easy to follow!!
    the SQL install needs updating.. thing i did it right but its changed from the one in the tut.
    Can you make one for tera wurfl?
    it has installation instructions but i dont really understand them…

  5. Thanks.You have made such a beautiful blog for people like us and I really thankful to you from all developer community.

  6. When installing PHP and it asks for Server Setup type, should I choose Apache 2.2.x module, Apache CGI, or IIS CGI? I chose Apache 2.2.x module originally but the php.ini file looks slightly different. The extensions aren’t commented and look like this for example:


    1. Based from your first comment it seems that you downloaded the PHP installer instead of the zip file (that only need to be extracted only)

      So my suggestion is download the php zip file instead of the installer :)

      And then depending on your choice, if you decided to go with PHP version above 5.3.5 (the link to 5.3.5 is provided in the update) then you can use Apache build from BUT if choose PHP version higher than 5.3.5 you need to use the Apache binary from Apachelounge

    2. In the update where you tell me to do this:

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

      is that right? cause there’s not a folder titled htdocs in the c drive…

    3. You have to create the directory by yourself (if you’re going with the old php version route, you don’t need to change or create the directory because it’ll be created automatically). But because you’re going with the new php route, you need to create the directory by yourself (i forgot to mention this on the XP guide at the Seting up PHP part. On Vista/7 Guide the creating htdocs dir in C is described at Setting up PHP). I’m sorry for this i’ve updated this post

  7. Sir,while installing mysql,in the ‘MYSQL sever instance configuration’ window,when i click EXECUTE at the last step,’Start service’ bubble is marked red.How to fix the problem?

    1. Did you get any error message? also if MySQL configuration failed, you can retry by running the MySQL Configuration Wizard from the start menu. Also it’d be better if you could post the error message (look at the MySQL installation directory for a file named my.cnf and see where the datadir points to, and then goes to that datadir location and look for a file with .err as its extension)

  8. Great work, it helped me to get the AMP up and running on XP! Thanks.

    Please update step 3 in Installing PHP on Windows XP to 3. Open php.ini and locate extension_dir directives,uncomment and change the value into”. I forgot to uncomment the line and had trouble connectiong to MySQL from my php script.

  9. i was getting error “Call to undefined function mysql_connect()” when i run php to use mysql.Then i follow your steps and it solve the problem. Thanks you

    1. First i need you to check several things:

      1. Is apache process running (httpd.exe is listed in task manager)? and if it’s not running could you type below command at the command prompt (if it’s running skip this step)

      netstat /aonp TCP | find /i "list"

      And look for anything similar to below (look at the :80 part)


      That mean there’s another program using port 80 (skype is an example) and you need to change that program to listen at different port OR change apache to listen at different address by editing the httpd.conf and change listen 80 to listen XX where XX is your desired port and not being used by another program

      But if you change apache to listen at different address, make sure to append :XX after the host name whenever you need to access it. For example http://localhost:XX/test.php (XX should be changed to the value you put as apache listening port)

      2. If apache is running and it is listening at port 80 (not at different port), try accessing http://localhost/test.php.txt … and if it’s working that mean you didn’t create a php file but a text file instead which is caused (if you’re running notepad) by notepad appending .txt automatically if you didn’t choose to save the .php file as all files when saving the file

  10. I love your guides, they have helped me alot.

    I have 1 probelm when it comes to the MySQL. When I choose Execute it fails at “Start service” and I get
    “Cannot create Windows service for MySQL. Error: 0”

    I’ve read the other comments but they dont work.

  11. I know it’s got to be something silly but I have installed and configured Apache server and PHP5 and when I run the browser for the test.php file I get the old 404 error webpage not found. All of my configurations are exactly as you have them in the example…server is localhost, php is in PHP5 directory on C. Any ideas on what’s missing? I only have one other idea that could be a problem I suppose and that is that the Applian miniport also listens on 80. Possible conflict? Any help you could provide would be greatlt appreciated.

    1. found the problem….didn’t save test.php as Save AS with quotes (“test.php”) so it saved the file as a text file as opposed to a php script file. Sorry to bother you but maybe this will help others.