Previously i wrote a how to guide on installing Apache HTTPD 1.3 on Windows machine. But it seems that some people prefer to use the new Apache 2.2 series instead of the old httpd 1.3 series which is not good when used on production system (read: if you allow anyone to access your webserver), beside the apache website itself tell you this :
the older 1.3 series was never designed to run on Windows, but that support was ‘hacked in’, introducing a large number of potential thread saftey issues and other confirmed problems.
And that’s why i choose to create the apache guide again but this time it is using the 2.2 series, and of course this guide tell you on how to setup your apache server with php 5 manually not using an all in one package. And here’s the guide :
Requirements :
1. Apache 2.2.x : At the time i wrote this guide, the latest stable version is 2.2.26 (btw get the non-ssl version unless you plan on using ssl)
2. PHP 5.2.x : 5.2.4 is the latest stable version when i wrote this (get the zip version, not the installer)
And here are the steps :
Note : in this example i’m using the default installation path for Apache 2.2
1. Install Apache 2.2 until below screen appears and use this information (or adjust it to your liking) and then continue the process until finished :)

2. To make sure Apache is working now you need to open your browser window and type http://localhost as the address, and if you get the same message like below image that mean apache is working

3. Thanks God the Apache seems to work … but now you’ll need to configure apache so it’ll recognize the php files and can parse the php files correctly. And the first thing you should do is extracting the PHP zip archive somewhere, and in this example i extracted the php 5.2.4 files into C:\PHP-5
4. After finished with the extraction process, now you just need to go to your Apache installation path, and then open httpd.conf which is located under the conf directory using your favorite text editor. Btw if you installed apache using the default path, here’s what the apache directory structure looks like

5. In order for apache to parse the php files correctly, first you need to Load the PHP5 module into the Apache, and to do this you just need to add below line to your Apache httpd.conf (after the last line of the loadmodule section) :
LoadModule php5_module “c:/php-5/php5apache2_2.dll”
Note : Adjust the php path accordingly if you extracted it into other directory
And here’s the image :

5.1 Now you need to search for (use your text editor built-in search function) :
<IfModule mime_module>
and then add these lines inside that directive (before the closing </IfModule> for mime_module )
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
6. After finished with the above process, now you’ll need to configure apache so it’ll check the existence of index.php by default too instead of just checking the index.html only for the default index filename, and here’s how to do it
The default configuration from Apache 2.2 :
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
The modified version :
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Notice the difference ? i’m pretty sure you’ll notice it right away … but like everyone knew that a picture worth a thousand words (read: because my English language is bad), so here goes the picture

7. Now we are done with the httpd section, now we need to configure php. Here are how to do that :
7.1 Copy php.ini-recommended from your php5 directory into C:\Windows (or your windows path) and then rename it into php.ini
7.2 Open the php.ini file using notepad and change the extension_dir as shown on below image :

7.3 Now you need to copy some dlls from your php 5 directory into C:\Windows\System32 :

Im pretty sure that you can’t read the filename from the above image, but don’t worry because all you have to do is just :
Right click and choose Arrange Icons by name, and then copy each file shown on the above image into your windows system32 directory, and you’re done (hint: hold CTRL key to select multiple files)
Or … copy all dll files at the root of your php directory into your system32 directory except those that is using php5*.dll
8. Now we’ve configured php, apache … but what else do we need ? of course we need to make sure that php really working and apache can parse it without problem, so we need to create a php test page first, here’s how to do it :
8.1 Create a file named test.php inside C:\Program Files\Apache Software Foundation\Apache2.2\htdocs (because that’s where the default document root path of your apache)
8.2 Add below line to the test.php file like shown on below image, then save and close the notepad

9. Okay … finally we’ve reached the final stage !!! now you just need to open command prompt and type like below image :

If you can’t read what you should type from the above image, actually you just need to type :
net stop apache2.2 && net start apache2.2
to restart your apache 2.2 process
10. Now after finished restarting the apache process, we need to open the browser window and point to http://localhost/test.php

If you see something shown like on the above image, that means Apache and PHP is working on your system
Congrats … now you’ve got apache and php 5 working on your system the only thing left is … adding mysql support (if you plan on using a registration page for your Mangos Server or other private server), and to do this you just need to remove the ; from the extensions, for more information, you can download the sample php.ini and httpd.conf as a supplement for this short how to guide
Hint : Compare the sample php.ini file you’ve downloaded with the default php.ini file from the php.ini files included in PHP archive (in this case you can find it on your windows directory)
Hopefully i didn’t miss anything, but if you do notice that i miss something, please let me know so i can fix it or add it :)
Thanks to Al for the suggestion :)
Leave a response
hmm you dont see the difference there… but the first one is quote marks that my keyboard doesn’t support (the main reason I copy pasted it), the second is bolded normal quote marks.
#Reaper-X
Yes actually I did, I copy pasted the one you posted. But as you say, it was incorrect;
Your previous:
LoadModule php5_module “c:/php-5/php5apache2_2.dll”
The line in the downloadable file:
LoadModule php5_module “c:/php-5/php5apache2_2.dll”
#Reaper-X
Argh lol >.<
# Muskar
Actually your previous 3 comments got caught in my automatic spam filtering (usually spammers use bbcode combined with html simultaneously)
and fortunately i checked my spam area today (usually not), and found your comment there or else you’ll be flagged as spammer on various website that use the same spam filtering lol
Invalid Loadmodule path ?
did you enclose the path name using double quotes ? "D:/php-5/php5apache2_2.dll"
(you can safely copy the above text, i’ve make sure that it doesn’t get transformed into curly quote) :)
rofl, this time it worked? >.<
Hmm, each time I include a [ b ], or it doesn’t sumbit the page, it refreshes it instead. Whatever anyways, sorry for bothering you.
it did..
(sorry for this, just testing fast:
[b]test[/b] – BBCode small
[B]test[/B] – BBCode large
test – html standard
test) html advanced
Well, ok, it’s no problem with the english, and I’m not new at using my computer for technical reasons.
I will respond how it works. (I suddenly remember an error I got before step 9, I’m pretty sure it was something like “Invalid LoadModule path \x93d:/php-5/php5apache2_2.dll\x94″ as elliot said.
TESTING IF IT WORKS WITHOUT MY HTML CODES
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|—————————————|
|Darn it didn’t appear, here goes again.|
|—————————————|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Well, ok, it’s no problem with the english, and I’m not new at using my computer for technical reasons.
I will respond how it works. (I suddenly remember an error I got before step 9, I’m pretty sure it was something like “Invalid LoadModule path \x93d:/php-5/php5apache2_2.dll\x94″ as [b]elliott[\b] said.
(sorry for this, just testing fast:
[b]test[/b] – BBCode small
[B]test[/B] – BBCode large
test – html standard
test) html advanced
TEST – SORRY
Did my comment not appear?
It doesn’t show up even if I restart my browser.
TEST – SORRY
Well, ok, it’s no problem with the english, and I’m not new at using my computer for technical reasons.
I will respond how it works. (I suddenly remember an error I got before step 9, I’m pretty sure it was something like “Invalid LoadModule path \x93d:/php-5/php5apache2_2.dll\x94″ as [b]elliott[\b] said.
(sorry for this, just testing fast:
[b]test[/b] – BBCode small
[B]test[/B] – BBCode large
test – html standard
test) html advanced
I hope there will be comments today, or some time soon.
If I forgot to specify something before you can make a reply, please tell me what it is.
Hello,
I under stand your problem. you are faceing apaceh restarting problem. Its some times accures, when you donot successfully edit httpd.conf file in apache conf folder.
I suggested you, first download file from this site httpd.conf file, just over write it into your apache conf folder. And make sure where you are extrait php. default folder in this guide is c:\php-5
And make sure that php-5 is root directory in c: drive. And all php .dll and files are stored in this folder with out any sub directory.
If you are create php-5 folder in d: drive and edit line in httpd.conf file.
If you donot know how to edit files and your are new lerners, i suggested you, just create a folder is c: drive with php-5.
Hope this will help you. My english is not too good.
Thanks,
Vishal
vishalgaurav01@gmail.com
linuxvishal@yahoo.com
Yet again, thanks for the awesome guides.
I completed every step so far, and everything was working until this:
This is what happens in my CMD in step 9:
I type
‘net stop apache2.2 && net start apache2.2′
And this happens:
‘The Apache2.2 server is stopping.
The Apache2.2 server was stopped successfully.
The Apache 2.2 service is starting.
The Apache 2.2 service could not be started.
There was a servicespecific error: 1
There is more help available if you type NET HELPMSGR 3547′
(This is the translated version, as I do not use an english version of windows).
# aivanho
Did you install PHP 5 in ‘D:/php-5/’ ?
If not, then adjust it, as the default drive is ‘C:/’
If it is the correct drive, then I’m afraid I’m unable to help you. I wouldn’t be here if I wasn’t new at using Apache and PHP.
oh and thanks vishal even though that wasnt exactly the solution i looked into a bit more, reaper i would suggest adding this info to your guide for xp users(and maybe vista) and thanks for your awsome and easy guides
Ok i fixed my server 404 error with windows xp(maybe vista too not sure) it hides your file extension ex. i renamed my test file test.php but since windows xp hides the extension it was really
test.php.txt i did a quick google search and the only way i could find to change extensions in xp is to open any folder go to tools>folder options>view and uncheck hide extensions for known file types(i didnt look long there may be better ways) now all your extensions should be showing and renaming the files\extensions will work right
Hello,
If you are see 404 server error.First check that you are successfully installed apache and php on your system. And goto your apache installtion directory and open htdocs folder, then create test.php .
Make sure that test file must have .php extension. some time you rename file, but it donot rellay changes to .php.
Hope this tips is help you.
Thanks,
Vishal
vishalgaurav01@gmail.com
linuxvishal@yahoo.com
i am getting the 404 not found error in my error log it says script ‘D:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test.php’ not found or unable to statt
Hi,
I am able to install apache and php on my machine and get info about php verson.
But when i am trying to test this nothing is displayed
Hello World Script
<?php
echo “Hello World!”
?>
Hello,
I am just read your guide, and found help full. But i have one suggestion, You can add list of files to be copyed to system folder from php folder.
You add a picture, this is good. But differnet machine have differnet screen resolution and hard to find files for them.
Thanks,
Vishal
vishalgaurav01@gmail.com
Hay, thanks for the great tutorial. I did the first one then found the updated progs one here and so far all is excellent.
Except for the signup page. I have move it into the required dir, and it can be accessed, but it doesnt show online people and when i try and make an account and hit submit i get error 500
“There is a problem with the page you are trying to reach and it cannot be displayed.”
any idea’s?
thanks in advance
I have a problem is: “Invalid LoadModule path \x93d:/php-5/php5apache2_2.dll\x94
Can you reply for me as soon as possible, thanks in advanced!
yeah once i find out how to set it up on apache.. how can i set it up on the web?
sorry to bug you again but, i cant get a registration template to work write.. is this html correct? :
<?php
/* Thanks to Peec for these nice functions */
function check_for_symbols($string){
$len=strlen($string);
$alowed_chars=”abcdefghijklmnopqrstuvwxyzæøåABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ123456789″;
for($i=0;$i ‘localhost’,'db_username’ => ‘createuser’,'db_password’ => ‘create’,'db_name’ => ‘realmd’,);
$username = $_POST['username'];
$password = sha_password($username,$_POST['password1']);
$email = $_POST['email'];
$tbc = ( $_POST[bc] == “on” ) ? “1″ : “0″ ;
$realmd_bc_new_connect = mysql_connect($realmd[db_host],$realmd[db_username],$realmd[db_password]);
mysql_select_db($realmd[db_name],$realmd_bc_new_connect);
mysql_query(”INSERT INTO account (username,I,email,tbc) VALUES (’$username’,'$password’,'$email’,$tbc)”);
$error = “Errors: “.mysql_error().”\n”;
mysql_close();
if ($error == “Errors: “.”\n”)
{
echo ”;
echo “Welcome “.$_POST[username].”";
echo “your email is: “.$_POST[email].”";
echo “your Burning crusade status is:”.$_POST[bc].”";
}
else if ($error == “Errors: Duplicate entry ‘”.$_POST[username].”‘ for key ‘idx_username’”.”\n”)
{
echo ” ERROR: USERNAME TAKEN”;
}
else if ($error != “Errors: “.”\n”)
{
echo ” ERROR: UNKNOWN ERROR, contact bigfootmech@”;
echo “gamil.com”;
echo “”;
echo $error;
}
else{
echo “Writing Error, contact bigfootmech@”;
echo “gamil.com”;
}
}else{
echo “ERROR: Passwords don’t match”;
}
}else{
echo “ERROR: INVALID CHARACTERS USED IN THE PASSWORD”;
}
}else{
echo “ERROR: INVALID CHARACTERS USED IN THE USERNAME”;
}
}else{
echo “ERROR: ENTER A PASSWORD”;
}
}else{
echo “ERROR: ENTER A USERNAME”;
}
}else{
?>
<form action=”" method=”POST”>
Username:
Password (and confirm):
Email you use (optional) – Your password can be sent to this email if you lose it:
Burning Crusade?:
i have no error messages and everything works fine but the test.php doesn’t work at all
When I put in http://localhost/ I get the it works message. When I put in http://localhost/test.php I get page cannot be found error. Even if I try to pull up an html document from the server it does not pull it up I still get a page connot be found error. I was wondering if you might have some suggestions for me?
doesnt come up with anything ? does that mean there’s no 404 not found error message too ? i’d suggest you to look at your apache error.log first :)
i have tried everything and all the parts work until i point my browser to my test.php and nothing happens….im confused
ok so i got everything to work up until the last part where u type in u web browser “http://localhost/test.php” its not working…. it doesn’t come up with anything….help?
Thanks for the help with that.
# Mr Neily and Enolam
Actually mangos use this function to encrypt your password (not normal sha1) :
if(!loginDatabase.PExecute(”INSERT INTO `account`(`username`,`I`,`joindate`) VALUES(’%s’,SHA1(CONCAT(UPPER(’%s’),’:',UPPER(’%s’))),NOW())”, username.c_str(), username.c_str(), password.c_str()))
return -1;
in order to test it directly without creating code :
1. open command prompt and type mysql -u root -p
2. type this :
SELECT SHA1(CONCAT(UPPER(’username’),’:',UPPER(’password’)));
for example you created a username with this info :
user : testingz
password : Passw0rd
mangos return :
ebdbe665dd1fdccc6ca6621ca2ab082e883f1f35
now try using the above mysql function :
SELECT SHA1(CONCAT(UPPER(’testingz’),’:',UPPER(’Passw0rd’)));
and you’ll get :
+——————————————————-+
| SHA1(CONCAT(UPPER(’testingz’),’:',UPPER(’passw0rd’))) |
+——————————————————-+
| ebdbe665dd1fdccc6ca6621ca2ab082e883f1f35 |
+——————————————————-+
that’s it :D
# Megavi
Changing 127.0.0.1 ? actually that’s a loopback address :)
# Q-Tip
thank you very much, although i did use it on the sample configuration, but i forget to include that in this post :D
can i change 127.0.0.1 to something else??
Why is it when I create an account with password: Passw0rd it comes up as
96e0dcdc5e4933cacc907ff742f356e8b96a9452
but when i try to use the creation page with SHA1 encryption it comes up as:
ebfc7910077770c8340f63cd2dca2ac1f120444f
What else is used for the encryption of the passwords when they are submitted?
Thanks for your help.
port foward to 80? how to do that?? can i change the name localhost to something else?? and change the website name from localhost to something else??
Oops, HTML must be enabled. I meant to say <IfModule mime_module> tags.
Add a step 5.1 or 6.1 to add the following to httpd.conf between the tags:
“AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps”
(Thanx, “man”)
http://us3.php.net/sha1
That is the website where it has it has a reference to SHA1. I am not a programmer tho. :) any ideas?
Reaper, first I would like to thank you for your wonderful guides! I have one problem.
I am using a php registration page that has the following lines:
mysql_select_db(’realmd’);
$q = “insert into account ( username,I,gmlevel,sessionkey,joindate,banned,last_ip,failed_logins,locked,last_login,online) values (’$u’,'$p’,'1′,”,NOW(),’0′,’127.0.0.1′,’0′,’0′,’2000-01-01 00:00:00′,’0′)”;
Now, I have to manually add banned as an integer to the field as a bandaid.
And i changed the password field into an I field so that it points to the right one.
The problem is that when the page inserts it into the db, in the correct field, it does not encrypt it as the server prgroam does. How do I get that php code to encrypt it so that the server understands it when the plays login?
Thanks!
I tried to use SHA1 when i encrypted the password on my page submit and when i try to login to WOW it doesnt recgonize the password. Any idea why?
ah you’ll need to get new registration page that support the new version of mangos (previously mangos didn’t use encryption)
as for the i field, it is encrypted using SHA1 :)
Hey, great guide, but I had a question, when I try to use the sample registration page it says that MySQL Database doesn’t have a field named ‘password’, I went into Navi and saw that the password field is called I, and the passwords are just a bunch of numbers and letters.
so basically what I am trying to ask, how do I get the registration page to work.
# ema
your welcome ema :)
finnaly i did it, it was two lines of code that were wrong.
thanks again, you saved me :)
thanks for the tip. Now i can restart apache, but when i test it with localhost/test.php he opens a little window asking me if i want to open or save the dreamweaver document. It´s like he can´t translate php code. what do you think?
# John
actually it’s just an example for Danaki :)
# Megavi
you’ll need to make sure that you’ve port forwarded the port 80 (or in some case you might need to change the apache port into something else because some isp doesn’t allow you to run your own webserver) :(
# ema
i’d suggest you to look at your event viewer log file :)
control panel -> administrative tools -> event viewer
i´ve followed everything you said, but when i tried to do the test he opened test.php direct in dreamweaver. then i´v tryed to restart apache again and now he can´t start, now i really don´t known what to do. can you help please!!!!!!!!!!!!!!
help me plz.. everything is perfect. but my friend cant go to my website.. =( help me plz!!
and what load php module are you talking about? I used the LoadModule php5_module “c:/php-5/php5apache2_2.dll”
if that’s what you were wondering when you asked Mike2, also I kept the guides directory structure, and configured the php.ini from php.ini-recommended to point to c:\php-5\ext, and the test configuration that comes with apache says it works fine, but it still does the download prompt…
I’m back, now curious why Apache loads fine and PHP is configured to the T of your guide, yet all the PHP files I use end up openning a download prompt…
# Danaki
did you enclose the php path using quotes ? ;)
for example :
Loadmodule blabla “C:/php/hoho.dl”
note : don’t copy paste from here because it’ll automatically transform quotes into curly quotes
Sorry for all the posts in a row. Just one last question. I have set this up on my computer in order to test pages made prior to uploading them to the internet so as I make pages do I need to put them in the htdocs folder in order to properly view them?
dont worry about it :) .. as for your question :
the simple answer would be .. yes :) .. unless you change the document root path in your httpd.conf ;)