Configuring the Apache Web Server to Run PHP on Windows
Listed below is information on how to configure the Apache web server to run PHP programs on
information on installing and configuring Apache for Windows, please see the following:
Installing and Configuring Apache for Windows
For information on configuring Apache to run other programming languages such as Perl, Python, and Ruby, please see the following links:
1. Install PHP
PHP needs to be downloaded and installed before continuing.
You can download PHP from the PHP download page at
http://www.php.net/downloads.php. Download the zip package from the "Windows
Binaries" section. This guide will assume the PHP version is version 5.x.
Create a folder on your machine for PHP. For example, c:\php. Extract all of the files from the zip file to the c:\php directory.
Copy the file called c:\php\php.ini-recommended to c:\php\php.ini
If you want to be able to see error messages from your PHP pages, open EditRocket and open the php.ini file. Search for the line display_errors, and make sure the value is set to On.
2. Configure Apache to run PHP as a Module
This guide assumes you are using apache 2.2. To configure Apache to run PHP, the httpd.conf file
needs to be modified. This file is located in the apache installation directory under the conf
folder. Open the httpd.conf file in EditRocket and do the following:
A. Add the following line after all of the LoadModule statements:
LoadModule php5_module "c:/php/php5apache2_2.dll"
B. Search for AddType, and add the following after the last AddType line:
AddType application/x-httpd-php .php
C. Add the PHP location to the end of the httpd.conf file. For example, at the end of the file, add the following:
3. Restart Apache
Now, the apache web server needs to be restarted. You can do this either via the Apache service located in the services control panel or via the Start -> All Programs -> Apache . . . -> Control Apache Server menu option.
4. Run a test PHP page
You can use the EditRocket hello world PHP template for a test PHP page. This is located in
File -> New From Template -> php -> Hello_World_Program. Save this file as test.php to your
htdocs folder under your apache installation directory. Open your web browser and type in your
apache host (and :port if the port is something other than 80) followed by test.php, for example