Install And Configure PHP

August 14, 2016 by Giryavva Ghodake

Filed under php

Last modified August 14, 2016

Installation and configration

Step 1: download the files

Download the latest PHP 5 ZIP package from

virus scan the file and check its MD5 checksum using a tool such as fsum.

Step 2: extract the files

install the PHP files to C:php, so create that folder and extract the contents of the ZIP file into it.

PHP can be installed anywhere on your system, but you will need to change the paths referenced in the following steps.

Step 3: configure php.ini

Copy C:phpphp.ini-recommended to C:phpphp.ini. There are several lines you will need to change in a text editor Define the extension directory:

extension_dir = “C:phpext”

Enable extensions. This will depend on the libraries you want to use, but the following extensions should be suitable for the majority of applications (remove the semi-colon comment):


If you want to send emails using the PHP mail() function, enter the details of an SMTP server (your ISP’s server should be suitable):

[mail function]; For Win32 only.SMTP = mail.myisp.comsmtp_port = 25 ; For Win32 only.sendmail_from =

Step 4: add C:php to the path environment variable

To ensure Windows can find PHP, you need to change the path environment variable. From the Control Panel, choose System, (then “Advanced system settings” in Vista), select the “Advanced” tab, and click the “Environment Variables” button.

Scroll down the System variables list and click on “Path” followed by the “Edit” button. Enter “;C:php” to the end of the Variable value line (remember the semi-colon).

Now OK your way out. You might need to reboot at this stage.

Step 5: configure PHP as an Apache module

Ensure Apache is not running (use “net stop Apache2.2” from the command line) and open its confhttpd.conf configuration file in an editor. The following lines should be changed:

Line 239, add index.php as a default file name:

DirectoryIndex index.php index.html

At the bottom of the file, add the following lines (change the PHP file locations if necessary):

# PHP5 moduleLoadModule php5_module “c:/php/php5apache2_2.dll”AddType application/x-httpd-php .phpPHPIniDir “C:/php”

Save the configuration file and test it from the command line (Start > Run > cmd):

cd Apache2bin httpd -t

Step 6: test a PHP file

Create a file named index.php in Apache’s web page root (either htdocs or D:WebPages) and add this code:

<?php phpinfo(); ?>


Leave a Comment