Having trouble installing PHP for use with Apache 2.0.45? Getting strange error messages like "php4apache.dll" not found when it is in the directory you specified? Here's a shorthand set of notes to help. Disclaimer - this is what worked for me - hope it does for you as well.

  1. Vanilla install of Apache 2.0.45 using .msi installer

  2. Edit Apache httpd.conf file using the handy new start menu shortcut (programs->apache server->configure...) to add/modify the following lines:
    LoadModule php4_module c:/winnt/php4apache2.dll
    DocumentRoot "C:/weblocal" {not req'd to be this directory, just my preference over ..../Apache2/htdocs}
    <Directory "C:/weblocal"> {needs to be same as above}
    ScriptAlias /php/ "c:/php/"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
    AddType application/x-httpd-php .php4
    AddType application/x-httpd-php .htm
    AddType application/x-httpd-php .html
    AddType application/x-httpd-php .phtml
    Action application/x-httpd-php "/php/php.exe

  3. Unzip PHP to C:/PHP in folders as packed (may need to use bitzip or other unzippers that respect folders in zip file)

  4. Edit php.ini-original and save to c:/php/php.ini with following mods:
    doc_root = "c:\weblocal" {needs to be same as in #2, above}
    extension_dir = "C:\PHP"

  5. Put php4apache2.dll and php4ts.dll in c:/winnt
    (Note - this wasted a lot of time - didn't know the php4ts.dll had to be in the same directory as php4apache2.dll, and kept getting an error "cannot find file php4apache2.dll" which was untrue - it really couldn't find php4ts.dll. Note the use of php4apache2 - the 2 suffix is needed, there is one without the 2 in the kit as well)

  6. Restart Apache with the handy interface (programs->apache..>control apache)

  7. I created the following test script and put it in c:/weblocal as test.php:
    <?php $myvar = "<h3>Hi world!</h3>"; echo $myvar; phpinfo(); ?>

  8. Open a browser and enter as the url: http://localhost/test.php

Go Navy!

    Is it saying "php4apache.dll not found" and did u put php4apache2.dll in c:\winnt ?
    MAYBE u have 2 install the service packs.

      I have tried using the installer for php in windows and can not get it to work I actually have gotten it to work using the other package

        Thanks this was a huge help to me. The only thing I changed beside the directory I host the site in is I used "LoadModule php4_module C:/php/sapi/php4apache2.dll", and threw php4ts.dll in there with it. c:\winnt\ wouldn't work so well since I am running Windows XP 😉 .

        After that works perfectly, thanks again!

          Write a Reply...