Install Apache & PHP on window server 2008 R2

It would be very easy to install WAMP,LAMP, MAMP,XAMPP server but installing separate component for production server is little difficult process.Yes today I installed individual PHP ,Apache for window server 2008 R2  64 bit environment as per client requirement.Below is basic step to install.

Useful Links

Step-1: Install Apache

  1. First, download the latest version of Apache HTTP Server win32 binary without crypto MSI installer
  2. Select Next
  3. Select “I accept the terms in the license agreement”
  4. Select Next
  5. 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.
  6. Select the Typical Setup
  7. 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.
  8. Select Finish
  9. If a Firewall is enabled, make sure that port 80 and port 8080 are unblocked and open.
  10. 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!”

Step-2: 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.
<Directory “C:/HASLMS”>DocumentRoot “C:/HASLMS”

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.

<IfModule dir_module>DirectoryIndex index.html index.php main.php index.html


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

Step-3: Installing PHP

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

11.  Restart Apache

All set to install PHP and Apache on OS 2008.Now You must have to test php script to sure that PHP script properly working or not.Cheers!!!!!

LoadModule php5_module “c:/php/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/php”

About the Author