Running Apache on Windows 2003
This is an article to update this one on Apache in Windows 2000 as some steps may not be the same. You can read just this article in full to be able to at least have the basic running.
“Core” Software Version used in this article:
Software I run on this web server:
Hardware Used in this article:
1. Asus P4P800 Motherboard
2. 2 x 256mb of DDR400 Kingston Rams
3. nVidia MX440 graphic card
4. 1 x 36Gb 10,000 RPM Seagate Hdd (ST336706LC) on a Adaptec 29160
5. Instel Pentium 4 2.6C Processor
I’m jumping straight to installing Apache and take it that you know how to install a fresh copy of Windows 2003. You do not have to install anything except the Windows unless you want to run say, IIS and Apache on a single machine but who needs IIS when you have Apache right?
So just follow through the following screenshot, it will be exactly what you see if you use apache_2.0.52-win32-x86-no_ssl.msi downloadable from www.apache.org
Accpet > Next >
Put in a valid domain name if this is going to be a live server, if not, like the above, put in a dummy, leave the port or if you’re running a home server, you may wanna read up on this on how to do port forwarding as some ISP especially here in Singapore blocks port 80 which is the default port for any web server.
It is a good idea to install it in a directory that contains no spaces as some application or addon will need paths that has no spaces but for easy references in this article, we’ll use the default path.
Done! Now open up IE from your Windows 2003 machine and local http://localhost and you’ll see the following. That’s was really easy right?
From below onwards, you should think of your server load and potential usage of this server and run through the configuration as per your requirements. Below screenshot does not need to be followed strictly and are there for this tutorial purposes but if you’re running a test server, you can of course follow through.
mySQL installed and configured.
mySQL Errors we encountered
Problem 1 – When you encounter any errors at all, the best place to start searching for answers is using www.google.com but here a relatively common problem we had.
MySQL unable to start error. This seems to happen when you uninstall mySQL and reinstall it, somehow the service name does not get release. Simply use another service name solved it. You can use mySQL Administrator downloadable from http://dev.mysql.com/downloads/administrator/1.0.html to do this. Following is a short guide.
Start mySQL Administrator using the .exe shown below, you’ll see this after you have downloaded and unzip (the zip version):
Use the above settings to connect to the local machine. This assume you are running mySQL administrator from the same Windows 2003 machine. So use localhost will do. Username is root and not administrator and password is what you have set during the configuration steps after installing mySQL.
As above screenshot, go to Service Control on the left then on the right tab, choose Configure Service. Here you can change the name to something else. Remember to stop and start mySQL after you have made any changes. After this, you can choose to run the MySQLSystemTrayMonitor.exe That’ll sit happily in your tray till you need it.
Please explore the mySQL administrator software as it contains a lot of other useful information you can make use of at a later time. It is a very good tool.
Problem 2 – PHP and mySQL complains that you need “php_mysql.dll“. You need that believe me. As many systems will need that to run properly including phpMyAdmin. Just pop by to this link at Winforums or you can hope straight to the reply on that thread here. Alternatively, if that link is not working any more, pop by http://snaps.php.net/ and download anything there and you’ll most probably find it in one of those zip files.
Here’s a short “copy and paste”:
|Following by an admin at Winsforum nick “localhost”:I’m working on this right now btw, I’ll report back.
haha, oh crap. I tried so much stuff its not even funny. But I got it.
I got the newest snapshot here: http://snaps.php.net/
I used that, not sure if you need to or not.
Open your httpd.conf file, remove your old version 4 and 5 configuration and do the following:
Let me know.
Choose Apache, remember!
Configuring Apache to load PHP files properly.
Go to Start > Apache HTTP Server 2.0.52 > Configure Apache Server > Edit httpd.conf
Press Ctrl + F and find for DirectoryIndex as seen below:
Add in “index.php”
Next Ctrl+F again and look for ScriptAlias
Here’s something different from the Apache in Windows 2000 article. Insert that whole chunk of text into your httpd.conf Here’s it in text mode so you can simply copy and paste:
ScriptAlias /php/ “c:/php/”
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php-cgi.exe”
…and here’s the screenshot:
Save your httpd.conf
and restart your Apache Web Server.
Open that cute little Apache Monitor icon in your system tray > and click on Restart:
You must see the Restarted message, if it give error, go back to your httpd.conf and check if you made any mistakes copying and pasting.
Testing PHP with Apache works
Here, we’ll test if PHP loads properly by using a very simple file that you’ll create. Open up notepad and type in the following:
Save this file as phpinfo.php, remember to use the .php extension and save it in C:Program FilesApache GroupApache2htdocs Now, open up IE once again and local http://localhost/phpinfo.php You will see something like the following and if you do, PHP is working fine.
You can also visit http://sg2.php.net/phpinfo if you want more information on phpinfo.
The Path to Configurations
It is important now that you know where all your configuration paths are or at least know how to get there. You know now where to configure Apache (using httpd.conf) via the Start menu.
PHP is configured using php.ini which is located in C:Windows and you must restart your Apache web server everytime httpd.conf or php.ini is changed.
All your websites’s file are by default to be placed in C:Program FilesApache GroupApache2htdocs This path is configured within httpd.conf and can be changed to anything else should you need to.
For easy access, I put a shortcut to all these paths on my server’s desktop for easy access like this:
That’s it for this article. I will be writing up on how to install various stuffs on this new webserver that we have just created very soon, “stuffs” will include Coppermine, Geeklog and phpBB, then you’ll come to know that you can run all sort of system on this with a few tweaks here and there. Till then, take care.
– Contributed by etegration
14 March 2005