Edit php.ini in notepad and scroll down to the 'Paths and Directories' section.
- Replace
doc_root=
withdoc_root= "c:\apache2\apache2\htdocs"--------> Change file path accordingly if needed to whatever your Apache Servers document_root is. (In httpd.conf) - Replace
extension_dir=
withextension_dir="c:\apache2\php"---------> Change if needed to where you extracted the php files to earlier.
Save and Close php.ini.
- Copy
php4apache2.dll(or php4apache.dll if using version 1.x.x) from the 'c:\apache2\php\sapi' folder to 'c:\apache2\php' making sure that 'php4ts.dll' is there also. - Copy ALL dll files from 'c:\apache2\php\dlls' folder to 'c:\windows\system32'
folder.
If any dlls already exist in system32 folder , DO NOT* overwrite them unless php does not work after following the 'Step 5 -Testing Your Installation' section.
* - dlls are funny creatures, shared files being used by many programs, in my case I did overwrite all dlls that were in the system32 folder and have suffered no side effects as a result. I do not however want to be held accountable should you have a program that requires an older version of a dll that this installation might otherwise overwrite.
Step 4 - Configure Apache2 for PHP 4
Revisiting our earlier Apache 2 tutorial I said:-
Locate and edit 'httpd.conf' file (should be in 'C:\Apache2\Apache2\conf\httpd.conf')
--------------
In Section 1 : Global Environment.
ServerRoot should say : ServerRoot "C:/Apache2/Apache2"
Locate #ExtendedStatus On and just below it add :-
AddHandler server-parsed .shtml #LoadModule php4_module "c:/apache2/php/php4apache2.dll" #AddType application/x-httpd-php .php
The last 2 lines above are commented out to avoid errors, they will be un-commented when php4 is installed,but we put them here now to save time later.
So now we want to un-comment out those lines so they read like this :-
LoadModule php4_module "c:/apache2/php/php4apache2.dll" AddType application/x-httpd-php .php
The rest of 'httpd.conf' should be ok if the earlier tut was followed, so Save and Close this file then 'Stop and Start' the Apache Server service. (A soft start called a 're-start' differs slightly in operation from Stop/Start in regards to the Apache Server and I have had problems with it in the past so don't recommend it until all bugs are squashed!)
Ok, so lets get testing!
Back to Download & Install PHP 4 | Forward
to Testing your Installation ![]()

