Apache Server (www.apache.org
) Download: Win32 Binaries(installer)
) Download: Win32 Binaries(installer)
) Download: Win32 Binaries(get zip, not installer)
Install Apache Server/Perl/PHP:
1) Run the installer of Apache Server that you have downloaded. The newest version of Apache Server made your life easier, but I am going to still teach you how to configuration it. Install it to "C:\Program Files\Apache Group\Apache2" (default). You can make up on each box like "host name, email, or etc.." while you are install, because you will configuration it anyway when you are finish with the installer. Do not run it when you are finished with the installer! Wait until later.
2) Run the installer of ActivePerl that you have downloaded. Make sure it install at "C:\perl" (default). Do not run it when you are finished with the installer! Wait until later.
3) Unzip (if you get the zipped verion) or install (if you get the installer version) PHP that you have downloaded. Make sure it unzip or install at "C:\php" (default). Do not run it when you are finished with the installer! Wait until later.
Configuration Of The Apache Server:
1) You will need to configure a file called httpd.conf at "C:\Program Files\Apache Group\Apache\conf". You will need to open it with notepad or your favorite editor. I am going to explain you step by step to edit it. Also, I am going to explain to you why to edit them so you can edit them to enable or disable on your own in the future. The next step is going to begin to search, edit and replace few lines.
2) Find "ServerAdmin email@example.com
" replace it with your email address. You better put your email because when someone got problem with your server and they will see your email, so they can contact you.
3) Find "ServerName" or "#ServerName localhost" replace it to "ServerName localhost". There has very clearly explain in this file when you find "ServerName", so I don''t need to explain about it.
4) Find "DirectoryIndex index.html" and replace it to "DirectoryIndex index.htm index.html index.php index.php3 index.phtml index.shtml index.cgi index.pl". It''s for where file you want it to be in front page on www.domain.com
. Common always has index.html as the front page. I added a lot of those, so I don''t need to edit this file again. It''s in the order, which will recognize index.html first then index.pl at the last.
5) Find "Options Indexes FollowSymLinks MultiViews" and replace it to "Options Indexes FollowSymLinks Includes" if you want SSI (Server Side Includes) enable, unless you want keep it disabled. If you do want SSI then change your order of index''s in the previous set to make index.shtml the first.
6) Find "AllowOverride None" right after "Options Indexes FollowSymLinks MultiViews" (above) and replace it to "AllowOverride All" to have the ability control the .htaccess files to override in directories, unless you want keep it uncontrolled.
7) Find "ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"" and add "ScriptAlias /php/ "c:/php/"" right after it. This will enable the PHP in your Apache Server. You don''t have to add it if you don''t wish to add PHP.
Find " # And for PHP 4.x, use:" and add 2 lines, "AddType application/x-httpd-php .php .php3 .phtml" and "AddType application/x- httpd-php-source .phps" right after it. It will make Apache Server able to accept and view files with the extentions php, php3 and phtml. Again, you don''t have to add it if you do not wish to add PHP.
9) Find "#AddHandler cgi-script .cgi" and replace it to "AddHandler cgi-script .cgi .pl". Reason why I added ".pl", is so Apache Server will accept and able to view either files with extentions of either cgi and pl as perl files. If you do not do this your .pl scripts will be an unreconized file extention and your users will be prompted to download the file instead of view it as a page. You can add or make up like ".blah" and it will still view as normal like cgi and pl files.
10) Find "#AddType text/html .shtml" and replace it to "AddType text/html .shtml". It will enable SSI, so you can leave it as disabled if you don''t wish to enable SSI.
11) Find "#AddHandler server-parsed .shtml" and replace it to (add two lines) "AddHandler server-parsed .shtml" and "AddHandler cgi- script .shtml". It will enable the server to render both normal html based includes aswell as cgi scripts, so you can leave it as disabled if you don''t wish to enable SSI.
12) Find "# Format: Action handler-name /cgi-script/location" and add "Action application/x-httpd-php /php/php.exe" right after it. It need to local where the PHP''s directory, so it will able to view the PHP files. You don''t have to add it if you don''t want to have PHP in your Apache Server.
13) Find "Options FollowSymLinks" and change it to "Options FollowSymLinks +ExecCGI". This will allow you to run CGI scripts on your server (as long as you have perl)
You are done with configuration Apache Server!
Configuration Of PHP:
1) Find php.ini-dist file at "C:\php" and rename it to "php.ini".
2) Open php.ini with notepad or your favorite editor.
3) Find a line "extension_dir = ./" then change it to "extension_dir = "c:\php"".
4) Copy the php.ini and paste it at "C:\windows" or "C:\winnt", or wherever you usually put your *.ini files, but the best idea to put it at either "C:\windows" or "C:\winnt".
5) Copy the msvcrt.dll and php4ts.dll from PHP directory to "C:\windows\system" or "C:\winnt\system", or wherever you usually put your *.dll files, but the best idea to put it at either "C:\windows" or "C:\winnt".
You are done with configuration of PHP
First Time Running Your Apache Server:
You will need to reboot your machine when you are done with the above steps. After that, the Apache Server should be run automaticly on Windows 2000 Professional. I doubt Apache Server will run automaticly on Windows 95/98/98SE/ME, so you will have to start it by yourself in the menu at "Start > Apache httpd Server > Control Apache Server > Start". *Warning, you will have to restart your Apache Server each time when you edit Apache Server's system file.*
Anyway, let''s begin to test your Apache Server, Perl, and PHP to see if those are working great. Here are more steps again.
1) To test the Apache Server, open your browser and type "http://localhost", "http://127.0.0.1" or your IP address. If you don''t get any errors, but some names like: "Apache blah blah" with an apache image. Woohoo, everything is fine with Apache Server!
2) To test the Perl, copy the perl script below and save it as both "hello.pl" and "hello.cgi" (so you will have two files the same, but with different extentions).
Running Apache On A Different Port:
A lot of ISP's do not want people to run servers from their home connection so they typically block port 80, in in order to get around this you will need to tell apache to use a different port. The best port to use in place of 80 is 8080, this is a common port for proxies to use also. Then once you change apache so it uses that port you will have to type the domain/ip in like this "xxx.xxx.xxx.xxx:8080", that will tell your browser to connect to teh webserver on that port.
To change the port apache uses:
1.) Find "Listen 80" and change it to "Listen 8080"
2.) Find "ServerName localhost:80" and change it to "ServerName localhost:8080"
Also, if you have a router and want people outside of your network to be able to see your website/server you will need to forward port 8080 to your servers internal IP address.
How To Get CGI-Scripts Windows Compliant:
If you want to run CGI scripts on your windows server you will have to edit the script (the first line anyway). So open it up in a text editor and find
"#!/usr/bin/perl" or something similar (it is almost always the first line of the script) and change it to "#!c:/program files/perl/bin/perl.exe"
You are all set now, enjoy playing with your new windows server!