Setting up a PHP Development Environment - Part 2: Installing PHP4
Part 2 assumes you have a working installation of Apache 2.0 please refer to Part 1: Installing Apache if you haven’t already done so.
Requirements
- Apache 2.0.x
1. Download the PHP 4.3.x Windows Binary zip package from http://www.php.net/downloads.php .
2. Run a virus scan and an MD5 checksum to verify the integrity of the download, then unzip to the same root directory as your Apache installation. I have Apache under C:\Apache2, so I have unzipped PHP to C:\php4 .
3. Now edit your php.ini file:
Rename C:\php4\php.ini-dist it to php.ini
Open the php.ini file, locate doc_root and set it to whatever your Apache DocumentRoot is set to. Mine is doc_root = “C:\public_html”
Note: Remember that when adding path values in the Apache configuration files on Windows, all backslashes such as c:\directory\file.ext must be converted to forward slashes, as c:/directory/file.ext. A trailing slash may also be necessary for directories.
Scroll down to extension_dir = “” and set it to the location of the ext directory of your PHP installation extension_dir = “C:\php4\extensions”
Since where using windows we also have to set the session save path to an existing directory so we can use PHP’s sessions functions. I recommend using the Window’s temporary directory session.save_path = “c:/windows/temp” OR for Win2k session.save_path = “c:/WINNT/Temp”
4. Next edit your Apache Conf file (hppd.conf )
For PHP 4 add the following line and copy your php4apache2.dll file from the sapi directory into the php4 root directory:
LoadModule php4_module "c:/php/php4apache2.dll" AddType application/x-httpd-php .php
For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php
And for both configure the path to the php.ini file:
PHPIniDir "C:/php"
5. Now test your installation - first restarting the Apache server - by creating a simple phpinfo file:
< ?php
phpinfo();
?>
Save this file as phpinfo.php in your webroot C:\Apache2\htdocs and run it through your web browser http://localhost/phpinfo.php. You should now be faced with a printout of your servers settings.
If you do not see this page check to make sure you have restarted Apache by right clicking the Apache monitor in your task bar.
You have now completed your installation of PHP 4.
For more information please refer to php.net’s documentation Apache 2.0.x on Microsoft Windows






You can read the first article about setting up Apache on PC here: http://www.melbournechapter.net/wordpress/system-administration/apache/rich/2006/07/10/setting-up-a-php-development-environment-part-1-installing-apache/
Comment by Cameron Manderson — July 25, 2006 @ 1:53 pm
[…] Welcome to Part 1 of our 3 part series, “Setting up a PHP Development Environment”. Please note we will be using a Windows XP environment for our installation. If you have come here in search of an article on how to install PHP please refer to Part2: Installing PHP4. Requirements : […]
Pingback by melbourne chapter » Setting up a PHP Development Environment - Part 1: Installing Apache — July 25, 2006 @ 2:30 pm