As of this writing, the current version of Apache is 2.2.4 and PHP is 5.2.2.
- Download the Apache Windows MSI Installer from Apache.org
- Download the PHP Windows Zip Package from PHP.net.
The first step to getting Drupal running on your Windows machine is to set up the Apache web server by running the Apache MSI installer. The following steps will walk you through the installation:
- Select Next
- Select "I accept the terms in the license agreement"
- Select Next
- Fill in your server information if it is known. A typical setup will use the "for All Users, on Port 80, as a Service" option. If this is being setup as a test machine, you may use localhost as the Network Domain and the Server Name. Select Next.
- Select the Typical Setup
- Choose a Destination Folder for the Installer to place the program files into. Note: the default Apache Installer location is C:\Program Files\Apache Software Foundation\Apache2.2. Because of the spaces in the directory name, using this folder may cause cgi and php scripts to not find the paths correctly.
- Select Finish
- If a Firewall is enabled, make sure that port 80 and port 8080 are unblocked and open.
- To test if the Apache server is running, open up http:\\localhost in a browser. A plain black and white page should come up that reads "It Works!"
- Using a text editor such as Notepad, open the httpd.conf file. This file is found in the /conf sub-directory under the directory that was set up during installation. Alternatively, a shortcut may be found in the start menu under the Apache HTTP Server folder.
- Note: Windows based systems uses backslashes \ and Unix based systems use slashes / for paths. In the Apache configuration files, slashes / should be used in path names.
- Change the DocumentRoot to point to the location of the root document folder. In the default httpd.conf file, this is found on line 149 and if the defaults were used during the installation, it would point to "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs".
Note: Wrapping the path name in quotes will escape out any spaces that are used.
- Change the Directory path to match the one used in the previous step. This is found on line 177 of the default httpd.conf file.
- Add to index.php to the DirectoryIndex. This is found on line 212 of the default httpd.conf file.
- Append the following lines to the end of the httpd.conf file:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
- Save and Close
- Unzip the PHP files to C:\php
- Copy c:\php\php-ini-recommended.ini and rename itc:\php\php.ini
- Uncomment the Windows include_path on line 506
Note: In the PHP.ini file, semicolons are used to denote that something is commented out. To uncomment a line, simply remove the semicolon.
- Update the doc_root to match the one that was set up in the httpd.conf file on line 513.
Note: The PHP INI files uses the Windows style backslash \ for path names.
- Update the extension_dir on line 520 to "C:\php\ext"
- Uncomment php_gd2.dll extension on line 637.
- Uncomment mysql.dll extension on line 651.
- Update the sessions.save_path to the Windows temporary files directory (i.e. C:\Temp).
- The PHP directory needs to be added to the Path Environment Variables
- Open the Control Panel
- Open System > Advanced > Environment Variables
- Append ;C:\php to the end of the Path System Variables list and Click OK.
- Restart Apache
- To test PHP on Apache, go to the root directory (i.e. C:\Program Files\Apache Software Foundation\Apache2.2#92;htdocs) and create a new php file in it. In this file, use PHP's phpinfo() function to see the server's configuration information. For example:
<?php phpinfo() ?>
Open this file in a browser (i.e. http:\\localhost\filename.php).