First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Jeffrey F. Hill | Website: http://www.flash-db.com

Installing PHP 4.2.0 and configuring with Apache 2.0

First we have to download PHP 4.2.0,  You can do so at the following link:
http://www.php.net/downloads.php  (PHP 4.2.0 zip package).
Or more specifically here: PHP 4.2.0 zip package 

The installation file that comes with PHP 4.2.0 does not come with instructions on how to configure with Apache 2.0 but is still a useful reference.  Also for everything you ever need to know, want to know, and more then you can ever know about PHP read over the documentation at http://www.php.net/manual/en/

1) After you have downloaded the zip file.  Unzip all of these files to the C:\  directory.  This will create a directory structure like:   C:\php-4.2.0-Win32 Rename this folder to C:\PHP

2)  Copy the file  C:\PHP\php.ini-recommended file to your windows folder: c:\winnt or c:\windows.  

3)  Rename this file (php.ini-recommended) to php.ini once you have placed it within the windows folder. You can rename the file with Notepad.  Since the php.ini file is often used I like to place a shortcut to it on my desktop. 

4)  Copy the file  C:\PHP\php4ts.dll file to your windows system folder: c:\winnt\system32 or c:\windows\system (for XP and ME it's the windows\system folder). 

We now need to edit both the PHP.ini file and the Apache httpd.conf file.

Open up the httpd.conf file that we where working with when we first installed Apache with Notepad.  Look for a block of LoadModule commands (this is located near the beginning of this file).  Then insert the following line right after all the the other LoadModule commands:

LoadModule php4_module c:/PHP/experimental/apache2filter.dll       (Make sure to use forward slashes for this path instead of Back Slashes).

Please note that you must use the apache2filter.dll and not the php4apache.dll.  With earlier versions of PHP (before 4.2.0 and Apache 2.0 you do however use the php4apache.dll)This is an important change to keep in mind when using earlier versions of Apache with PHP.

We have to add one last item to the httpd.conf file before where done with it.

Add the following Line to your httpd.conf file (somewhere after the LoadModule command we just added);

AddType application/x-httpd-php .php 

Next Edit the PHP.ini File.  

For now all we have to add is the 'doc_root' path (Search the file for doc_root to find it faster).  Add the path to the htdocs folder.  This path will be something like:  C:\Program Files\Apache Group\Apache2\htdocs so that the line now looks like:

doc_root = C:\Program Files\Apache Group\Apache2\htdocs

That should be it.  At least it should be enough so that PHP will be running in conjunction with the Apache web server.  To test this try the following.

Create a file named PHPInfo.php.  Include the following in that file:


Then add this file to your htdocs folder.  Open up a browser and type in the following URL:  http://localhost/PHPInfo.php  If everything went successfully you'll see a long list of all your PHP settings and server information.  When starting Apache you should also see a small note that the PHP 4.2.0 module has loaded, also when your viewing the 'Apache Service Monitor' you should see a small note at the bottom indicating that PHP 4.2.0 is running. 

On the next page we'll go into some exercise's and fun stuff to do with PHP and Apache.

» Level Advanced

Added: 2002-05-08
Rating: 9 Votes: 108
(10 being the highest)
» Author
Jeffrey Hill is a freelance web developer from Boulder, Colorado. He specializes in creating and developing dynamic database driven Flash content, applications, and content management systems. Specialty's include SQL, PHP, Perl, XML, web services, and Flash clients for web services.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.