How to Install and Configure PHP 3 on Windows

Tips on installing your own PHP for testing your scripts offline.

How to Install and Configure PHP 3 on Windows

by Christopher Heng,

Since uses PHP scripts for various purposes, I find it convenient to have my own copy of PHP on my computer so that I can test my scripts offline, instead of having to test and debug them while connected to my ISP. If you have to pay phone and ISP fees for your Internet connections, you may also find this route a cheaper alternative. You will still have to do some testing online, but at least most of the bugs would have been ironed out by the time you upload the script.

Here are the steps you need to install and configure PHP 3 on Windows.

Note that this article deals with the installation and configuration of PHP3 (ie, version 3.X of PHP). If you want to install later versions of PHP, please read one of the following articles instead:

Download the PHP binaries

You can obtain the PHP binaries (executables) for Windows from

Install PHP

This is extremely easy. Simply make a directory somewhere on your hard disk. For example, you could create a subdirectory called c:\php3 and unzip all the files into that directory. The examples in this guide assume that you have used that particular directory.

Configure PHP

Your c:\php3 directory will contain a file called "php3.ini-dist". Copy that file into your windows directory (C:\WINDOWS in most systems), and rename it to "php3.ini".

Open C:\WINDOWS\php3.ini with a text editor (eg, Notepad) and search for the string "extension_dir". The default value is probably "./". Change that to the directory into which you installed PHP. If you used the values suggested above, the line should now read

extension_dir = "c:/php3"

This determines the place where PHP looks for extensions like graphics drawing, database support and the like.

If you need such extensions, you will need to enable them separately. You can find these in the section "Dynamic Extensions" (search for it). So if, for example, you need GD support (for drawing graphics and images), you need to uncomment (remove the preceding semicolon, ";" from) the line


If you don't know what all these extensions do, simply set the extensions_dir variable for now.

Install the Apache Web Server (optional)

One way to test your scripts is to install Apache on Windows as well. Then all you would have to do is to put your script in the web directory and access it via a browser connected to your local server.

You can find instructions on installing and configuring Apache from my article How to Install and Configure Apache on Windows at

Configure Apache to Use PHP

Skip this step if you are not installing Apache. The first thing you'll need to do is to edit your Apache configuration file, httpd.conf. If you installed Apache into the default directories, you can find that file in "c:\Program Files\Apache Group\Apache\conf\"

Search for the portion of the file which has the ScriptAlias section. Add the following line after the ScriptAlias for "cgi-bin":

ScriptAlias /php3/ "c:/php3/"

Apache needs to be configured for the PHP MIME type. Search for the "AddType" comment block explaining its use, and add the following lines after it:

AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3 .php
AddType application/x-httpd-php3 .phtml

You can of course add whatever extensions you want Apache to recognise as PHP scripts.

Next, you will need to tell the server to execute the PHP executable each time it encounters a PHP script. Add the following somewhere in the file, such as after the comment block explaining "Action":

Action application/x-httpd-php3 "/php3/php.exe"

Note: the "/php3/" portion will be recognised as a ScriptAlias and the value you set earlier will be substituted in its place.

Using PHP without Apache

Use a text editor and type the following script for testing purposes.


Save the file and run PHP with the file as a parameter. For example, if the file was saved as "test.php3", you might use the following command line:

c:\php3\php test.php3

You should get a HTML file with lots of information about your PHP setup.

Using PHP with Apache

Place the script given in the step above in your htdocs directory, and use your usual method of accessing your web files to access it. You should get the same output as the step above.

Remember also to download the entire PHP documentation set from the PHP website. You should also check up this site often (or just sign up for the free newsletter) for more PHP tutorials and information.

Copyright 2000-2014 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.

Related Pages

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Install and Configure PHP 3 on Windows

Link to Us
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Web Hosting
Perl / CGI
.htaccess / Apache


Free webmasters and programmers resources, scripts and tutorials Free How-To Guides
Site Design Tips at
Find this site useful?
Please link to us.