Installing PHP

Usually not necessary: If you get problems with the Apache/PHP-integration you can try to move (or copy) both php.ini and php4ts.dll to your windows path (e. g. C:\winnt or C:\windows).

Some times you also have to change the Windows include path in php.ini from ;include_path = ".;c:\php\includes" to include_path = "." (remove ; and at least use a dot (.) as include_path.)

You must also do some configuration changes in the Apache configuration file to get PHP to work. Open C:\web\Apache\conf\httpd.conf in your text editor (e. g. Notepad) and do the following changes:

DocumentRoot "C:/web"

<Directory "C:/web">
      

Use / (forward slash) and NOT \ (backslash)!!!!

Find the line AddType application/x-tar .tgz and add the following lines below:

        ScriptAlias /php4/ "c:/php/"
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php4
        Action application/x-httpd-php "/php4/php.exe"
      

To avoid file listing in stead of running index.php files you can add index.php to the DirectoryIndex parameter:

        DirectoryIndex index.html index.php
      

Save your file. You now have to restart the Apache web server to activate the changes.

After restarting the Apache server you can make a test file to check that the PHP extensions work. Start your text editor, write

<?php phpinfo(); ?>

and save the file in C:\web as test.php

Start your webbrowser with the web page http://localhost/test.php or http://yourPCname/test.php. You should get a lot of information about PHP.

Setting up PHP as Apache module

Above we have set PHP Server API to CGI. To get better speed etc. it can be a smart move to change from CGI to Apache. To do that you must open httpd.conf and replace the lines below:

ScriptAlias /php4/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
Action application/x-httpd-php "/php4/php.exe"

with:

LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php

You must MOVE php4ts.dll from C:\php to C:\windows\system32 (or C:\winnt\system32). php.ini should be moved to C:\windows (or C:\winnt). Stop and start Apache to activate the changes.