Quote of the day : "Religion is the smile on a dog" Emma Bunton

Next quote in 22.1 hours. [suggest a quote]

Installing an Apache server on Windows


This tutorial will guide you, step by step, through the installation of Apache 2.2, along with PHP 5 and MySQL 5 (and phpMyAdmin), under Windows.
For this tutorial, we used apache_2.2.4-win32-x86-no_ssl.msi, php-5.2.1-Win32.zip, mysql-essential-5.0.37-win32.msi and phpMyAdmin-, on a machine running Windows XP Pro SP2.
Warning : in this tutorial, we are configuring a server that will send error and warning messages that will help you for development, but may reveal security breaches to potential hackers. So, DO NOT use this server for hosting purpose, use it only for development (unless you edit the configuration files as appropiate).


All links


Running the installer

On the Server Information screen : On the Setup Type screen : choose Custom.

On the Custom Setup screen : choose what you want to install. You can leave all the default values if you want. We left the default component settings (full installation), and changed the install path to E:\INTERNET\Apache Group\Apache2.2\.

Configuring Apache

You know have a new icon in your taskbar : the Apache Monitor. Whith this little tool, you can with a few clicks turn on/off or restart your Apache server. If you close it, you can find it again in the Start menu (Programs → Apache HTTP Server 2.2.4 → Control Apache Server → Monitor Apache Servers. Then, go to your Apache folder (for us it's E:\INTERNET\Apache Group\Apache2.2), and open httpd.conf (located in the conf folder). Here are a few important parameters (there is more help about them in the httpd.conf file itself, so we just list them) :


Congrats, you're done with Apache ! Wanna see the result ? Okay, but not too long, we still have some work to do.
In your taskbar, double click on the Apache Monitor icon. Huh ? It's rather raw, isn't it ? Don't worry, that's not your site :). Press restart : this will stop the server, and relaunch it with the modified httpd.conf.
Put some html pages in the folder you entered in the DocumentRoot field (see above).
Open your favorite browser (I hope it's not MSIE, btw ;)), and in the address bar, type (where 8080 is the port we chose a bit earlier in the tutorial). Here are your pages, and you could share it with anyone on the web, if they had your IP and if you let Apache go through your firewall.


Close Apache (not mandatory but let's act cleanly).

Unzipping the stuff

Extract your php file (for us it was php-5.2.1-Win32.zip) in some folder. We extracted it in E:\INTERNET\PHP.

Configuring PHP

Go to your PHP folder (for us it's E:\INTERNET\PHP). Copy php.ini-dist as php.ini, and open this php.ini.

Configuring Apache to work with PHP

Go to your Apache folder and open httpd.conf (located in the conf folder) : In your PHP directory (for us, E:\INTERNET\PHP), copy the file libmysql.dll and paste it into the bin directory of your Apache folder (ie, for us E:\INTERNET\Apache Group\Apache2.2\bin).

Hello World

Well, time for another break. With notepad, create a file named somename.php, containing :
<?php phpinfo(); ?>
Save it into your server directory (for us it's C:/SERVER/HTTP). Now launch Apache (or restart it). With your browser go to You should see a page listing a lot of things about your server :)


Close Apache (not mandatory but...)

Running the installer

On the Setup Type screen : choose Custom.

On the Custom Setup screen : choose what you want to install. You can leave all the default values if you want. We left the default component settings, and changed the install path to E:\INTERNET\MySQL.

On the MySQL.com Sign-Up screen : do whatever you want... we chose Skip Sign-Up.

On the Wizard Completed screen : leave the Configure the MySQL server now checkbox ckecked. This opens the MySQL Server Instance Configuration Wizard.

Configuring MySQL

If it isn't already opened, launch the MySQL Server Instance Configuration Wizard (In the Start menu, go to Programs → MySQL → MySQL Server 5.0 → MySQL Server Instance Config Wizard).

On the Please select a configuration type screen : choose Standard Configuration.

On the Please set the Windows options screen : let the default options (Install As Windows Service, Launch the MySQL Server automatically)).

On the Please set the security options screen : just set the root password.

Creating the links to launch and close MySQL

You can use batch files to quickly launch or stop the MySQL service.
See the tutorial about batch files if you need help.
For instance, create a file named MySQL_launch.bat with the following content :
net start MySQL
(where MySQL is the name you gave to the MySQL service during the installation process).
Create another file named MySQL_stop.bat with the following content :
net stop MySQL
Now, to launch the MySQL Server, all you have to do is run MySQL_launch.bat. To close the MySQL Server, run MySQL_stop.bat. You can create a link to these batch files and put these links in the start menu, but this tut isn't the place to explain this).
If you get stuck because of these files, tell us on the forum : we can send you our batch files.
A last note : you can do the same kind of batch files with the Apache2 service.


Sorry, nothing new to see here. Move on to the next section, there'll be much more things to see.


Unzipping the stuff

Extract your phpMyAdmin file (for us it was phpMyAdmin- in a folder within your server's folder. We extracted it in G:\SERVER\HTTP\Restricted\phpMyAdmin. Move all the files and folders into G:\SERVER\HTTP\Restricted\phpMyAdmin (instead of leaving them in the original G:\SERVER\HTTP\Restricted\phpMyAdmin\phpMyAdmin-

Configuring phpMyAdmin

Create a config directory in your phpMyAdmin folder (G:\SERVER\HTTP\Restricted\phpMyAdmin for us).
Launch Apache and MySQL (if they aren't already running), and with your browser, go to (or to wherever you installed phpMyAdmin). You get an error message with a link to the setup script.
Go to the setup script. Find the Servers section and click on Add.
Enter the MySQL root password in the Password for config auth field.
Finish adding this server (click on the green Add button).
In the Configuration section, click on Save.
Copy G:\SERVER\HTTP\Restricted\phpMyAdmin\config\config.inc.php to G:\SERVER\HTTP\Restricted\phpMyAdmin\config.inc.php.
Go to again.
Here you are, phpMyAdmin is configured.

Just a last security feature

You probably noticed that you don't need any password to use phpMyAdmin, which means that virtually anyone can access your database through phpMyAdmin. Let's add some protection.
To sum up : for instance, we have 3 files : Now go back to your browser, to : it asks for a username and a passord, for us it's patheticcockroach and mypassword.


Congrats, you now have a brand new Apache HTTP Server with PHP and MySQL support, running phpMyAdmin as a database administration tool.
What's more your phpMyAdmin folder (and perhaps other folders, or even your whole server) is secured by a password.
Do not forget to keep links to the Apache Monitor, MySQL_launch.bat and MySQL_stop.bat for easier use (but you can still use the common Windows Service management system).
Comments :
Help - I followed all the instructions but no luck (mityac, on Thu, 03 Apr 2008 16:04:38 -0400) Report Reply
Newcomer Hi,

I followed all your instructions for the install but I have problems at the configuring phpMyAdmin stage. When I enterthe url c:\SERVER\HTTP\Restricted\phpMyAdmin I get an error page like this:-

phpMyAdmin - Error
Cannot load mysql extension. Please check your PHP configuration. - Documentation. It has links on mysql and documentation but neither is as you have described as there is no link to a setup script. I am installing a slightly newer version phpMyAdmin- but that was what was available.

Please can you help.


Replies :
(PatheticCockroach, on Sun, 13 Apr 2008 11:39:43 -0400) Report
Admin Sorry for the late reply, I don't check the website as often as the forums.

Anyway, this is not really the error you should get ;) This errors means that you probably didn't configure PHP for MySQL properly, most likely you forgot to uncomment, in php.ini, the line about php_mysql.dll
[Add a comment]