Install PHP For Windows IIS

Download & Unpack
Download and install PHP from http://www.php.net/downloads.php, you should grab
the newest 5.x.x Windows Binaries zip package that will work on apache.

My file was named: php-5.2.9-1-Win32.zip
Unzip php. In my case, I unzipped to:
C:\php\
Rename C:\php\php.ini-dist it to php.ini
Edit your php.ini
Open php.ini in a text editor and scroll down about halfway through the file and
look for doc_root then change it to point to whatever your Apache DocumentRoot
is set to. In my case: doc_root = “C:\public_html”

Scroll down about 7 more lines and change the extension_dir from extension_dir =
“./” to the location of the ext directory after you unzipped PHP. in my case:
extension_dir = “C:\php\ext”

If you are going to be using your server for testing, i recommend (this is
optional) you search and change the error reporting to give you info on any
errors, notices, or bad coding. If you want to enable this type of stuff, search
for error_reporting for and change:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
to
error_reporting = E_ALL | E_NOTICE | E_STRICT

Editing Apache Conf File
Using Notepad open httpd.conf (should be start-menu shortcut “Apache HTTP Server
2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File”).
Either at the very beginning or end of the file add the following lines: (NOTE:
be sure to change BOTH C:/php parts to the directory you installed your php to)
LoadModule php5_module “C:/php/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/php”

Note: If you installed the older Apache 2.0, instead of the above lines, you
will need to use the lines listed on the bottom step of the Apache 2.0 tutorial.
[OPTIONAL] Editing Apache Conf File (part 2)
To get apache to automatically look for an index.php, search httpd.conf for
DirectoryIndex (about line 212) and add the files you want apache to look for
when a directory is loaded (if it doesn’t find any of these files, it displays
folder contents). Mine looks like:

DirectoryIndex index.php index.html default.html

Testing
Restart Apache if it is already running (if it doesn’t start or you get errors,
use your Apache “Test Configuration” shortcut in the Start Menu to see why).

To test your PHP simply create a test.php file in your Apache “DocumentRoot”
folder (E:\public_html\ in my case). In your test.php file, type these 3 lines
and then load the file in your browser like http://localhost/test.php (you
should get a whole long list of php variables, settings, etc):

Documentation Suggestion
One weird thing I have noticed about PHP is that it does not come with
documentation of any kind. If you are a php developer/programmer, I suggest you
download the documentation. Downloads can be found on
http://www.php.net/download-docs.php and I personally recommend the “English -
Windows HTML Help” (chm) version as the search is so handy, although they all
contain the same information.

  • Meet Author

    S.Abhilash, started this blog in the later half of 2009 as a self hosting site for all his previous blogging attempts. , My way of writing and frequency of publishing may not be uniform as my resources are my projects nd issues i came across. For the last few years this blog is reacing 100 s of unique visitors each day, thanks wordpress and google for such a perfection in their software and services.

    Head to Authors Page | Abhilash on Facebook



Category Technology     Tags , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Comment on Facebook

1 Comment to “Install PHP For Windows IIS”

Community



FREE News Letter

Enter your email address

See Also

Resources

Please Submit your Email Address to Get Latest Technology News As it Happens


Enter your email address


Read previous post:
PHP MYSQL CONNECT

<?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } // some code ?>

Close