How To Install Apache And PHP On Windows Platform

PHP is a programming language that can be used to build powerful websites and web applications. A web server application is required to be installed on your computer in order to develop and run a PHP applications. In this tutorial, we are going to discuss about the methods of installing Apache server and PHP on your computer.

For installing Apache and PHP on your computer, you have to download their installation packages and installation manuals from their respective websites at first. I have already published an article with discussing about the methods of downloading and installing Apache server on windows platform, you can refer it from there.

After you have installed Apache server successfully on your computer, you can download required PHP distribution package from PHP website and install it on your computer. You can found three types of installation packages on the page of PHP for windows, which includes source package and windows zip package.With source package, you can compile from source for windows platform.

The windows installer version of PHP offers a convenient windows installer interface for installing and configuring PHP, which automatically configures the Apache, IIS, PWS and Xitami servers.In this tutorial, we will discuss in detail about downloading, installing and configuring PHP with windows zip package.

Downloading PHP Manual

All of the PHP projects offer truly explanatory documentation with covering every expect of the respective technology in detail. PHP documentation is available on online along with downloadable files on different formats in various languages, which are single HTML file (html.gz), many HTML file (tar.gz), HTML help file (chm) and HTML help files with user notes (chm).

Downloading PHP Package

You can download latest released version of PHP for windows from the page which are dedicated to supporting PHP on Microsoft windows. The installation packages are available either with source code or without source codes. The latest versions of PHP are available along with supporting for windows having 64 bits.

Installing PHP With Windows Zip Package 

1. After completing download, you can install it to your computer but you have to make sure that Apache server have been installed successfully on it.

2. Unzip the PHP package, that you have just downloaded and place the contents into C:\php. You are allowed to choose any of the installation directory but avoid choosing a path that contains spaces.

3. Rename the php.ini-dist file to php.ini and save it to the PHP installation directory. The php.ini file contains hundreds of directives that are responsible for tweaking PHP's behavior, you can configure it as your requirements.

4. Configure httpd.conf file for PHP which is located on Apache directory. Refer to the next session in this tutorial for configuring httpd.conf file for PHP.

5. If the Apache is not started highlight the label and click on start the service, located on the left of the label. If it is started, highlight the label and click on restart the service so that the changes made to httpd.conf file takes effect.

Configuring Apache For PHP

After successfully installing Apache server and PHP on windows platform, you have to configure httpd.conf file in order to run PHP and Apache server. Following are the steps  for configuring httpd.conf file on Apache for PHP.

1. At first go to Apache installation directory and open httpd.conf file for editing which is located on conf directory. If you have installed Apache on C:\ , navigate to C:\apache\conf\ to open httpd.conf file.

2. Consider adding following line of code directly below the block of LoadModule entries.
LoadModule php_module C:/php/php5apache2_2.dll
The name of  .dll file will be different for different version of PHP.

3. Now, search for "AddType" and add the following line of code just below it.
AddType application/x-httpd-php .php

4. At last, go to the bottom of the file and add the following line of code.
PHPIniDir "C:\php"

Testing PHP On Apache Web Server

After you have successfully installed and configured it for Apache, you can test on your web server. In order to test, write the following code on notepad and save it with the file name "phpinfo.php".

Save this file under "htdos" folder located on your Apache installation folder. Go to your browser and open "http://localhost/phpinfo.php", if you see the following screen on your browser, PHP was installed successfully.

How To Install Apache And PHP On Windows Platform
Internet & Web Designing|PHP|Programming Tutorials|