Saturday, January 12, 2013

PHP Installation in Apache


Following are steps for installing PHP enviornment in your Apache Server
Step 1: Download PHP from http://php.net/downloads.php

Step 2: Extract the files at some location say "C:\php".

Step 3: Define extention directory in php.ini
extension_dir = "C:\php\ext"

Step 4: Go to System Environment Variables
 -> In "System Variables" Block Select variable "Path"
 -> Click Edit
 -> Then at the end of value add the php folder i.e. "C:\php" path by separating from others with semi-colon(;)

In httpd.conf (in apache/conf)
Edit <IfModule dir_module> DirectoryIndex if (present) as below, otherwise add the following line.
DirectoryIndex index.php index.html

At the end, add the following lines
# PHP5 module
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

In above, replace "C:/php" with directory specified by you.

Save and test in command line
cd \Apache2\bin
httpd -t

No comments:

Post a Comment