As of this writing, the current version of Apache is 2.2.4 and PHP is 5.2.2.

  1. Download the Apache Windows MSI Installer from Apache.org
  2. 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:

  1. Select Next
  2. Select "I accept the terms in the license agreement"
  3. Select Next
  4. 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.
  5. Select the Typical Setup
  6. 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.
  7. Select Finish
  8. If a Firewall is enabled, make sure that port 80 and port 8080 are unblocked and open.
  9. 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!"

Configuring Apache:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Add to index.php to the DirectoryIndex. This is found on line 212 of the default httpd.conf file.
  6. 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
           PHPIniDir "C:/php"
  7. Save and Close

Installing PHP:

  1. Unzip the PHP files to C:\php
  2. Copy c:\php\php-ini-recommended.ini and rename itc:\php\php.ini
  3. 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.
  4. 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.
  5. Update the extension_dir on line 520 to "C:\php\ext"
  6. Uncomment php_gd2.dll extension on line 637.
  7. Uncomment mysql.dll extension on line 651.
  8. Update the sessions.save_path to the Windows temporary files directory (i.e. C:\Temp).
  9. The PHP directory needs to be added to the Path Environment Variables
    1. Open the Control Panel
    2. Open System > Advanced > Environment Variables
    3. Append ;C:\php to the end of the Path System Variables list and Click OK.
  10. Restart Apache
  11. 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:
    <html>
    <body>
    <?php phpinfo() ?>
    </body>
    </html>

    Open this file in a browser (i.e. http:\\localhost\filename.php).

Alternative Options: Bundled Packages

Comments

mindcorrosive’s picture

Please note that the latest PHP (5.2.8) is supplied as a .msi package for easy install on Windows. Also, most of the configuration options listed here are already taken care of (namely, extension_dir and session.save_path), and the php extensions (provided they are installed). Also during installation, one needs to specify the appropriate Apache module.

iridiumcao’s picture

"sessions.save_path" contained in the 8th item of Installing PHP section should be "session.save_path".

DigOurGame’s picture

http://www.sebastiansulinski.co.uk/tutorials/show_item/20/installing_php... This is up to date and current as of today 02/11/2011.

harezmi’s picture

Your explanations solved my trouble... I want to thank you... :))

onaryhopkins’s picture

Please note that on the third line of the script PHPIniDir "C:/php" - there should a closing front slash like PHPIniDir "C:/php/"

The abscence of this slash took away precious one week from me when I crashed the drupal installed on my local machine.

When I try to load a php file in web browser it simply interprets the scripts on web page.

Kallen5k’s picture

"5. Add to index.php to the DirectoryIndex. This is found on line 212 of the default httpd.conf file."

please clarify

Kallen5k’s picture

also please update the information to reflect accurate line numbers and information that may or may not be necessary.

vcouver’s picture

Something is wrong, since January 2016 with my Drupal 7.41 on Windows XP.
The "Available Updates" screen shows now "Failed to get available update data" for each module, including Drupal 7.41. But a few weeks ago, all was OK. For absolutly each module, the version could be checked on line. But now, that's impossible. I don't understand why.
Maybe the too old XP system ? But why now ? I've tried to stop the antivirus AVG. To reinstall Drupal 7.41; To reinstall xampp.But the message is always the same now.

Microsoft Windows XP Service Pack 3 -> "Failed to get available update data"
xampp 1.8.1
MySQL 5.5.27
Apache 2.4.3 (Win32)
OpenSSL 1.0.1c
Php 5.4.7
phpMyAdmin 3.5.2.2

I tried in the same conditions ( same place, same network ) , but with another machine, Ubuntu 15.04, and all Drupal 7.41 is ok on Ubuntu
"Up to date"
Linux Ubuntu 15.04 -> Checked available update data for 9 projects.
Apache/2.4.10 (Ubuntu)
PHP Version 5.6.4-4ubuntu6.4
MySQL Client API version 5.6.27

vcouver’s picture

There are no more "Failed to get available update data" on screen, after a windows update ( including XP,) , on february 10, 2016, and about some malware. The messages "Up to date" and "Checked available update data " are back. With Drupal 7.42 since february 3, 2016. But a new message is coming when using "Install from a URL" : "HTTP error -18966575 occurred when trying to fetch https://ftp.drupal.org/files/projects/admin_menu-7.x-3.0-rc5.zip." The only way to install, is to use "Upload a module or theme archive to install".