(Draft. As I'm not very fluent in English, suggestions for grammar improvements are welcome (if you can find my email address)).
This Apache installation guide is "informative" and more like personal notes that actual guide. You shouldn't take it as "absolute" truth of mankind. For more information about installing Apache can be found at location: http://httpd.apache.org/docs-project/.
This guide is made for Apache version 1.3.33 for Windows.
Although installing Apache on Windows is quite straight forward stuff, nothing
should be done without planning. Atleast you should determine where (at the
filesystem) you're going to install Apache.
Rule of thumb: Avoid C:\Program Files directory. C:\www
directory is much better choice.
Installing Apache is quite easy with graphical installation program.
Start installation by double clicking the apache_<version>.exe file or start it using start menu's run command.
First comes up some quite obvious stuff. Continue pressing next button.
Next we'll have lincense information. Do I need to say: If you don't accept
them, installation ends :-D.
Choose I accept the terms.... and press next button.
Next we have "basic" settings. Change these to match your system if the installation program didn't get them right. At this point it could be tempting to set Apache server to start as a service, but we'll hold our horses and do it later on. So choose the latter choice Run when started manually, only for me (<username>).
(Notice! You can use IP address or "localhost" if you're building a test environment).
Choose setup type:
If needed change installation location by pressing Change... button and choose new location. Continue installing by pressing next button.
After all files are copied into your harddisk, press finish button to end installation program.
If you chose Apache to start manually, try to start Apache in Console to see if your installation succed.
Install apache as a service:
x:\path\to\apache\apache -i -n "service_name"
You can also specify certain configuration by providing a path to your configuration file:
x:\path\to\apache\apache -i -n "service_name" -f \my_server\conf\my.conf
(Notice! -n option is introduced in version 1.3.7 and above. Default service name is Apache if you don't provide anything else).
Open registry editor (regedt32 not regedit):
Find key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Apache
If multistring DependOnService is not present you'll need to add it.
Add REG_MULTI_SZ value named DependOnGroup and leave it's data value empty. Add REG_MULTI_SZ value named DependOnService and set value as Tcpip Afd (each word at it's own line). Close the registry editor.
When Apache is installed as a service, the default account that it uses is LocalSystem. This means that there is no corner at your system where it cannot access.
Create a new user (eg. apache, wwwuser etc). Then we'll need to set Apache service to use this account instead of LocalSystem account. When you create a new user, remember to set following setting for it:
Open Start -> Control Panel -> Administration tools -> Services. Double-click Apache service and choose Log On -tab. Activate This account and supply username and password to use.
As we have changed the user for Apache service, It is also necessary to change file permissions for Apache's installation directory. Apache won't start if the file permissions aren't set for this new user (read, write and execute). You also need to remove permissions from Everyone -group in Apache's installation directory.
After this is done try to start Apache service:
net start apache
If you get errormessages check your Event viewer for errors (most likely they're about file permissions).
Covers version (4.x.x)
Donwload latest php 4.x.x version (zip file without installer) from http://www.php.net/downloads.php and unpack it to your hard disk (if you don't know where, c:\php is a good place to start).
Give Apache service's user read and execute permissions to this folder and remove Everyone group.
Make this directory available to your systems PATH. (My Computer -> Properties -> Advanched tab -> Environment variables. Double-click Path variable and add at the end of the line ;C:\php).
Copy dlls from C:\php\dlls to php's main folder (C:\php). Copy php4apache.dll file from C:\php\sapi to main directory (C:\php). Copy php.ini-dist to your systems %windir% directory (usually C:\windows or C:\winnt) and rename it to php.ini.
Make necessary modifications to php.ini file (such as extension directory path c:\php\extensions, upload temporary directory c:\temp etc). And uncomment extensions you'd like to use.
Note:
In some cases you need to install third party software to make some extensions to work.
Keep PHP manual at hand for such cases.
Open Apache's configurationf file http.conf and add lines (There are also bunch of other LoadModule lines in httpd.conf, so add this after them):
#LoadModule usertrack_module modules/mod_usertrack.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule php4_module "C:/php4/php4apache.dll" .... #AddModule mod_unique_id.c AddModule mod_so.c AddModule mod_setenvif.c AddModule mod_php4.c
And tell apache what to do with .php files (add these lines inside of <IfModule mod_mime.c>):
<IfModule mod_mime.c> ... Mime stuff ... <IfModule mod_php4.c> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule> <IfModule>
And add index.php to Apache's index file list:
<IfModule mod_dir.c> DirectoryIndex index.html index.php </IfModule>
Restart Apache:
c:\>net stop apache
c:\>net start apache
If you didn't get any error messages, PHP installation as a Apache module was
successful. If you get errormessages (most likely extension related) read them
carefully and modify your configuration files.