If you’re interested in running a website from your home server, you may have considered various options, including running PHP. But running PHP with IIS can be fraught with problems – or at least was, until WGS reader, Christopher Courtney, wrote the following guide to installing PHP for IIS on Windows Home Server. Over to Christopher…
Because running IIS and Apache really isn’t feasable, one needs to be able to install PHP into IIS. If you have tried before or searched for how, you will notice many different ways, and a lot of problems with doing so. I’ve tried several times and gotten the same problem, but finally fixed it and got PHP working under IIS. Now I am going to share it.
What You Will Need
- Remote Desktop Connection or Advanced Admin Console
- Regedit
- PHP 5.2.5 files zipped
- PECL modules for PHP 5.2.5 – For added support, functionality, and compatibility.
- MySQL Download – optional but recommended, many php applications require sql. And MySQL has a free version.
What to Do
You will need to download PHP. There are a number of issues with the installer, so we are going to be using the zipped file. Make sure the zip file is accessible from the server (it needs to be in one the shares, or on the SYS drive of the server.
You will need then need to gain remote access to your Windows Home Server box (Use a Remote Desktop Connection or Advanced Admin Console).
Install PHP
- Extract the files from the PHP zip and place the files in “C:\php”. Extract the PECL modules to “C:\php\ext”.

- Rename C:\php\php.ini-recommended to “C:\php\php.ini”.
- Open both the php.ini file you have now and uncomment cgi.force_redirect in php.ini and set it to 0

- Find SMTP = localhost and make sure it is uncommented. If your mail server is somewhere else you may specify it here. Also set this line just below the above: sendmail_from = someone@yourhost.com
- Change session.save_path as “session.save_path=C:\php\sessions” and make the directory C:\php\sessions
- Set the line “extension_dir” as “extension_dir = “C:\PHP\ext”.
- Uncomment the following extensions:
extension=php_mssql.dll extension=php_msql.dll extension=php_mysql.dll extension=php_mysqli.dll extension=php_java.dll extension=php_ldap.dll extension=php_iisfunc.dll extension=php_imap.dll extension=php_filepro.dll extension=php_gd2.dll extension=php_gettext.dll extension=php_dba.dll extension=php_dbase.dll extension=php_dbx.dll extension=php_mbstring.dll extension=php_pdf.dll extension=php_pgsql.dll extension=php_sockets.dll extension=php_xmlrpc.dll extension=php_xsl.dll extension=php_zip.dll
- This will enable you to use pretty much any database you may have installed. Additionally, it should allow you to use most functions for php that you will need.
- This part may not be necessary, but it was definitely for me. Go to “C:\” an right click on “Properties”. Go to the Security Tab, and click on the “Advanced Button”. Enable “Replace permission entries on all child objects with entries shown here that apply to child objects”, and click okay.

- Go to Control panel > System Properties > Advanced Tab > Click “Environment Variables”.
- Now add “C:\PHP;” to the very beginning.

- Now run “regedit.exe” or Start Registry Editor (same program)
- Add HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = “C:\php” to the registry.

- Open Internet Services Manager which is in your Administrative Tools.
- Right Click on Web Service Extensions located on the left hand side and choose Add a new web service extension. Enter in php and click add. Browse to C:\php\php5isapi.dll. Also set extension status to allow. Click “Okay”.

- Right Click on websites and choose properties. Go to the Documents tab and add index.php as a start document. Go to the Home Directory Tab and click on Configuration. Now go to the mappings tab and click on add. Enter .php for the extension and enter “C:\php\php5isapi.dll” in the executable textbox. Make sure all verbs is checked and click ok, click ok, click ok. You are done installing it. Now you need to test it.

- Go to C:\Inetpub\wwwroot and make a new text file and name it phpinfo.php. Open it up with your text editor ant put this in it: <?php phpinfo(); ?>.
- Open a web Browser and go to http://SERVER/phpinfo.php
- If you followed all the instructions, it should work fine.
Installing Your Database
Once you have downloaded the MySQL installer, run it on the server. I would run step by step through the install, but pretty much all the defaults are optimal for what we want. It’s going to run using as little resources as possible, and a small number of concurrent connections. This is what we want, because this the enviroment we are going to be running. We’re not running a dedicated database server after all.
So, that’s how to install PHP for IIS on Windows Home Server – we’ll be featuring a number of technical guides from Christopher over the next few weeks, all of which will be stored on the forthcoming We Got Served Wiki.
More Info: WGS Wiki








4. March 2008 at 6:22 am
Personally I find that any non Microsoft technology on a Microsoft platform is full blown aftermarket, like Japanese car parts on say a German car.…Don’t get me wrong – PHP is a force to be recond with on the *NIX platforms- I just think one is better of installing Ubuntu / Apache /PHP in say a virtual pc if one really needs to have it on the WHS or not at all
4. March 2008 at 7:10 am
The thing is, Windows Home Server already has a very nice website installed. And I am not alone in the idea that it would be shame to remove it, especially because of add-ins like Whiist, or to use multiple programs to get all the content that you want. PHP is very widely used, and very useful, so why not use it with IIS?
And as for aftermarket, so installing OpenOffice, or games, or anti-virus programs, or other utilites all fall into the same category. They are not needed per se, but doesn’t mean you shouldn’t. Apache works fine on windows, and PHP works great on that, better in fact. But for some of us with Windows Home Server boxes, running apache and IIS side by side by is not a solution, but installing php on IIS is. That is why its here. That, and I believe in sharing knowledge that others want and need.
4. March 2008 at 9:03 am
Great Step-By-Step Guide Terry, I’m sure it will be useful for many of your readers. However, uncommenting all of the PHP-extensions is something I can’t recommend due to security reasons.
The following extensions will probably never be used by anybody EXCEPT they know what they do and need and should not be enabled by default:
extension=php_mssql.dll (SQL Server on WHS anybody?)
extension=php_msql.dll (These functions allow you to access mSQL database servers.)
extension=php_mysqli.dll (experimental! http://de2.php.net/manual/en/ref.mysqli.php)
extension=php_filepro.dll (These functions allow read-only access to data stored in filePro databases.)
extension=php_dba.dll (These functions build the foundation for accessing Berkeley DB style databases.)
extension=php_dbase.dll (These functions allow you to access records stored in dBase-format (dbf) databases.)
4. March 2008 at 10:04 am
Sorry about that. Though, I cannot find anything about php_mysqli.dll be experimental at all. In fact, I have had issues connecting to MySQL databases without it. And if somebody does have SQL Server on their WHS box, php_mssql.dll would be useful, but other than that, yeah. The other entries have been removed on the wiki tutorial.
4. March 2008 at 5:12 pm
I just found out the notice about MySQLi beeing experimental is only in the german PHP manual (see http://de2.php.net/manual/de/ref.mysqli.php).
About MS SQL Server: there’s no reason for average joe to have a SQL server in his home environment but I agree it would be useful for somebody who has. However, I’d expect such a person to have enough IT knowledge to enable this explicit extension.
5. March 2008 at 3:52 am
As an average Joe, I would appreciate a lot some advise about how to make a better use of the internal WEB Page already present inside our Home Server. The point is that they made this software available to thousands of “joeS’ and now we need to make it more and more useful for them and not only for PhDs in Networking and computing. If “average Joes” need WHS is because they haven’t been able to make use of Windows NT, WIndows 2000, Windows 2003 (the real core behind WHS), .in their homes. Thanks for your effort for average Joes, and keep things on track fro them, please
7. March 2008 at 12:24 pm
I am not familiar with PHP, but have identified one useful (to me) PHP application, and uses a sql db …
Given my needs for a family usable photo library I have been evaluating an open source product “Gallery V2″ and like the concept. It is based on PHP, and given I have WHS (OEM version) I wouldn’t want to put it somewhere else, either.
Gallery is described at: http://gallery.menalto.com/
They have a link within for help installing on IIS, including PHP, MYSQL, …
http://codex.gallery2.org/Gallery2:Installation_Requirements#IIS
I didn’t have the benefit of this wiki, likely would have made the install a bit smoother … but still, not too many problems following the directions …
I have a P4 1.8GHZ, with 1.3gb RAM and 1.3TB storage. So far seems to run fine – for family use I don’t plan on high volume …
…other potentially useful PHP apps might be??? …
20. March 2008 at 10:10 am
That is a very nice gallery. And this would be a nice bonus to the best reason I can think of for PHP and MySQL
MediaWiki, the same wiki that wikipedia uses.
Directions for installing MediaWiki with IIS found here:
http://learn.iis.net/page.aspx/299/php-app-title/
And this is a case where an average user would need to enable extension=php_mysql.dl
1. April 2008 at 3:01 am
wow….my head hurts. This is a great tutorial and i’m doing my best to follow it but I’ve hit a few road blocks and just need some advice if anyone can help. I didn’t see a forum to ask questions, so, if I should be posting somewhere else, please let me know.
#4 Find SMTP = localhost and make sure it is uncommented. If your mail server is somewhere else you may specify it here. Also set this line just below the above: sendmail_from = someone@yourhost.com
If I’m using gmail and not running my server….would i put smtp=smtp.gmail.com.
#11Now add “C:\PHP;” to the very beginning.PHP Path
If I click on path and edit this is the path thats currently there C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\jre1.4.2_13\bin
Where do I placethe c:\php path? Just worried if I put it in the wrong place it would screw it up, it just didn’t look like the screen shot.
Thanks for any help anyone can give me.
Joe
7. April 2008 at 4:10 am
with MySql and PHP integrated into IIS, is it then possible to use phpMyAdmin? would phpMyAdmin go into “wwwroot”?
23. April 2008 at 7:55 pm
what version of mysql do i download?
and what windows type ?
Windows Essentials
Windows ZIP/Setup.EXE
Without installer
which out of these three?
4. May 2008 at 10:49 am
You would install the Zip/setup.exe for mysql. Sorry for not stating that, will update in the wiki.
9. May 2008 at 11:15 pm
Corrections needed…
9. Go to C:\php and right click…Doing this to the C: drive may cause irrecoverable changes to file permissions and may break other things like add-ins, apps, etc.
16. Open WebSites and right click on ‘Default Web Sites’ (like in the picture). If you apoply these changes to the entire web sites folder, it may break your built-in WHS web server…
I never checked the screenshots, just went by the text and had to rebuild the WHS. However, the good news is the re-install was easy and to re-connect a client, just go to the Windows Home Server foler in Program Files and run ‘Discover.exe’
10. May 2008 at 3:35 am
I broke my WHS built in web server as I followed the directions. is there a way to fix this without re-installing wHS?
10. May 2008 at 9:00 am
@Sippervixx: A number of these issues have been added to the wiki version based on feedback and me breaking my website and server.
11. May 2008 at 4:38 pm
just followed the wiki and it worked!
now I just have to learn PHP
24. May 2008 at 10:30 pm
Hi,
It looks easy but it’s not
I followed it to the letter but at the end when trying I get a “Internet Explorer cannot display the webpage” error.
The only thing that does not went the same as the tutirion is part 8 where I have to uncomment thos extensions. Some of there are not in the php.ini file. Also in the beginnen their is talk about both php.ini files. Wath the hell do you mean by that :d ?
Thx alot !
26. May 2008 at 2:52 pm
Hey guys,
I’ve followed this tutorial three times now, but i have a strange problem:
PHPworks just fine but it seems that the PHP install blocks the connector software from connecting.
Every time after installment of php i cannot login via the connector any more. Backups are just allright, but cannot login to the console.
gr. bram
27. June 2008 at 7:43 pm
hi
i did falow your guide step by step but i still geting the error (“The page cannot be found”) what am i doing wrong?
19. July 2008 at 1:50 am
In regards to step 9:
I don’t think this is a real good idea since you might change permissions in other child object that shouldn’t be changed.
Instead, do this:
Right click and select properties for the c:\php folder.
In the Security tab, select Advanced.
Remove all Permission entries that say in the “Inherited From” column.
Check both the “Allow inheritable permissions…..” box and the “Replace permission entries on all child objects…..” box, then click OK, and OK again.
Doing this limits permission entry changes to the PHP folder and all folders and files contained therein. By following the above instructions, this will remove all eroneous permissions generated at creation time and inherit permissions directly from the root directory.
19. July 2008 at 2:00 am
EDIT to my above post…..
Where it says:
Remove all Permission entries that say in the “Inherited From” column.
Should read:
Remove all Permission entries that say “not inherited” in the “Inherited From” column.
Sorry for any confusion here. Without thinking about it, I used greater than and less than signs since that’s how it’s displayed in the properties dialog and was cut out since it’s recognized as an html tag.
24. July 2008 at 12:58 pm
I have been having some problems getting my PHP to work. I have followed the tutorial, ran through the basic troubleshooting and I have no idea what more I can do.
When I load the page, the PHP isnt being read. SO I get a blank page.
I want to know what I should do if the extensions mentioned are not in the list of extensions that are already in my php.ini file.
I need to know if theres anything else that I can do that might help me fix this problem.
I would appreciate a response to this, or you can email me your suggestions at: JT081970 @ gmail . com
thanks for your help and time.
-JT
7. August 2008 at 9:42 pm
No offense, but after getting a failed install of PHP by following this tutorial, I went hunting for answers. I found a great guide here: https://technocore.homeserver.com/wiki/index.php?title=Category:PHP_for_Windows_Home_Server. It includes some steps not mentioned here – specifically the one about setting security on the C:\PHP folder, which probably caused my original problems if I had to guess.
29. January 2009 at 7:27 pm
To put it bluntly, i screwed around for ages trying to get php setup on whs. then I stumbled onto this article (hosted elsewhere http://www.tryphp.com/how-to-install-php-for-iis-on-home-server/ ). I followed the link back here to leave a message saying, Thanks so much!
I followed the step by step and it worked first time.
The only thing that threw me a bit was the lack of some DLLs in the extensions list. I didnt know if I should add them, or how the list was populated… was it automatically updated as new packages installed etc? Anyway, It works, and i’m happy
Thanks!
PJ
8. February 2009 at 9:24 pm
@Alexander K – I’ve been running PHP on IIS for years and have never had problems.
17. April 2009 at 12:22 pm
@Rob -
I agree with Rob.
I’ve been running PHP and MySQL on windows web server 2003 for years.
I’m now intersted in building a windows home server and using the same applications to host Gallery on this server.
23. April 2009 at 1:13 pm
thank you it works for me