Things You'll Need:
- A text editor, i.e., Notepad, Emacs, ConText
-
Step 1
Open the "conf" directory. Go to the "Apache" directory, and you should see a sub directory called "conf." Open the "conf" sub directory.
-
Step 2
Open "httpd.conf." Once you have entered the "conf" directory, you will see a file called "httpd.conf." This is the file where you will have to add code to configure PHP. Open this file in a text editor, preferably one that will conserve the file extension.
-
Step 3
Configure for PHP. Find the section of the file where the PHP information is listed and add the following lines of code (for PHP5):
c:/php/php5apache2.dll
AddType application/x-httpd-php .php -
Step 4
Specify path to PHP and save. Now you have to tell the server where PHP is located on the box. To specify the path to PHP, add the following code:
PHPIniDir "C:/Windows"
Save the httpd.conf file to the same location. Make sure that your PHPIniDir is under C:/Windows. This is the standard path configuration, but it is always wise to check because your programs will not run otherwise. -
Step 5
Test the installation. You can do this by running a basic PHP script on the server. To do this, copy the following code in an empty text document and save as "test.php."
<html>
<head>
<title>Test Apache Configuration</title>
</head>
<body>
<?php echo '<p>PHP is now installed</p>'; ?>
</body>
</html>
Load the file to your html directory as you would any other web page. After loading, open the page by typing in the address, e.g., "www.your_domain.com/your_root/test.php." If Apache has been properly configured, you should get a printout that reads "PHP is now installed." If it has not been installed, your browser will attempt to download the "test.php" file.












