The Giornale

Installing PHP with IIS Configuration

Posted by: liquidskinn on: July 17, 2008

————————————–

What is PHP? **source PHP.net

- PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Aside from this, it’s also open source which means, aside from the fact that it’s free for use, is that the features are always improving thanks to thousands of other programmers out there who supports the open source community.

————————————–

Why am I doing this now?

Simply because.. I want to. :) Nah! Kidding! I’m not saying that I’m good at this particular scripting language. I believe I don’t know half of what it can really do, actually. But right now, due to demands for a less expensive solution to deliver automated and web based needs for companies, I’m trying to tap into the stored knowledge again.

I learned PHP only last year, thanks to my very first corporate job after college. I told them specifically that I don’t know PHP (or, did I?) and yet, very generous they are, they said that I can learn it there straight. I’m very very extremely thankful to that company, or rather, to my bosses there. Thanks to them, I learned PHP without going to college all over again and pay some professor to teach me.

So.. now in this company where I am, I might try writing some of the applications using PHP instead of the proprietary and licensed .NET. YOu have to be wise these days, and going for licensed isn’t always a good idea.

————————————–

What will I gain from writing this?

First of all, I hope to provide a more, errr.. easier to understand guide on how to install a copy of it so you can try programming PHP for yourselves. What’s the point of it being open source and free and all if not everyone can get it and install it and configure it easily without a single fuss? Right?

Second.. I already did this before, at home. Problem is, I didn’t document it, so  I’m basically starting again from scratch. I hope that this time around, when I decide to format my system and install everything all over again, I won’t have to look very hard ( like now) to reinstall PHP. It’s like my own version of the installation manual, made easier for you and me.

————————————–

So, now let’s proceed! :)

For this, you’ll be needing:

- PHP itself. You can either download the source code or, if you want a no-frill installation, there’s also a self extracting Windows installer available. But! I suggest that you get the zip package instead because.. it adds more knowledge for you (you don’t always have to rely on installer packages if you can really do it yourself). You can get both of them from here.

- Web Server. Examples are Apache, PWS (for Windows 98) and IIS (for Windows 2000 above). I don’t know anything about Mac and Linux systems so, forgive me for that. PWS and IIS are included in your standard Windows package, but they’re not preinstalled. You have to install them yourself (you’ll need the Windows CD installer for this). Apache, on the other hand, is also open source, so if you want to go full blast on the open source solutions, I suggest you try this too. I, unfortunately, won’t be covering the installation and configuration in this post, but I will in another one so… wait for that. :)

————————————–

PHP Installation

Once you’ve downloaded the PHP zip package, do this:

- create a directory in C:\ called ‘PHP’ so that after it, you now have this directory : C:\PHP. It is suggested that you just create that folder under the root folder (C:\).

- extract all the contents of the zip package into  that newly created directory.

- look for a file called php.ini-recommended, rename it to ‘php.ini’ and open it using Notepad.

- inside that file, look for the text ‘doc_root=’ and beside it, enter C:\Inetpub\wwwroot. WWWroot is the root directory of the default web site in IIS.

- look for cgi.force_redirect, uncomment it (by removing the ‘;’) and replacing the 1 with 0.

- setup a session folder. Create a folder called Sessions under C:\PHP\. IN the php.ini file, look for session.save_path and make it session.save_path = C:\PHP\Sessions

- point PHP to the right location of extensions. Look for extension_dir and change it to extension_dir = C:\PHP\ext.

- for this next procedure, you can do either of these two steps:

(1) add your PHP directory to the PATH by going to Control Panel > System > Advanced Tab > Environment Variables. Under the System variables pane, look for the Path variable, click on Edit to edit it. In the variable value textbox, append your PHP directory location and add a ‘;’ at the end. Note: Don’t delete the others, you should just append it. Restart your computer.

(2) copy the file php5dts.dll to the Windows system directory.

- open Notepad, copy or paste this

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
“IniFilePath”=”C:\\PHP”

and save it as inifilereg.reg. After you’ve done that, double click on it to run it.

————————————–

Configuring IIS

Ok.. this part requires that you have already installed the IIS component. If you haven’t yet, now’s the best time to start.

When you’re done with that, do the following: **I’m using Windows XP SP2

- go to Control Panel > Administrative Tools > Internet Information Services. The Internet Information Services window will pop up.

- Collapse the Internet Information Services > [computer name] > Web Sites . Right click on Default Web Sites and click Properties.

- under ISAPI Filters tab, click Add. Put ‘PHP’ as filter name, and browse to the location of the php5isapi.dll file. It should look like this:

- GO to the Home Directory tab and choose Scripts only for the Execute Permissions option (bottom).

- click the Configuration… button and choose the Application Mappings tab

- click Add and set the Executable path to the php5isapi.dll file.

- input .php as the extension

- click OK a few times till you get back to the main Information Services Window

-restart IIS by right clicking on Local computer > All tasks > Restart IIS. See picture

————————————–

Testing if it does actually work

Of course, the whole thing would be rather senseless if it doesn’t work right? To be able to do that

- run Notepad and paste the following code:

<?php
echo ‘PHP is working.<br>’;
echo phpinfo();
?>

- Save it as phptest.php and place it inside C:\Inetpub\wwwroot.

- Then, go to your browser, and type http://localhost/phptest.php.

- The output should look something like this:

————————————–

And that.. is how it works! :) Hehehe I hope I’m able to help you out in this. If you have questions, please feel free to leave a comment.

1 Response to "Installing PHP with IIS Configuration"

[...] PHP 5 And Apache 2.2 This is a follow up post for this one, Installing PHP with IIS Configuration. [...]

Leave a Reply

Latest Tweets

  • likes the Wordpress logo so much that she uses it as wallpaper, and the main menu icon. 22 hours ago
  • is copying Coraline. I wonder if it's good though. 22 hours ago
  • this is another test from the office 1 day ago
  • okay, enough test, so far it works. :D This is so fucking awesome. Imma do this in the office PC too 1 day ago
  • this is another fucking test. I sure hpoe it doesn't end up in Plurk... 1 day ago

Blog Hits

  • 42,677 views

Technorati



Add to Technorati Favorites

Page Rank – Help me improve it!

Vote for The Giornale


Filter by date

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives