First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
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:

phpinfo();
?>

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!

Comments

  • 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: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.