One of the major advantages that the Apache web server enjoyed over IIS for years has been the native support for PHP.
Most Windows Hosting you get will, if you’re lucky, install PHP for you but not support it at best.
This left some of the best open source programs out there too much of a hassle for most users. With the release of the FastCGI module you can now reliably host PHP programs on IIS.
Let’s go ahead and walk through installing the Fast CGI Module and PHP.
A few prerequisites for installing FastCGI would seem obvious but let’s go ahead and mention them anyway.
The first of course is an installation of Server 2008 (though this works on Vista if you are so inclined) and having IIS 7 installed already. You can also enable FastCGI while installing IIS, but for this demo I already have a virtual server with IIS 7 installed so let’s go with that.
If you need help installing the web server you can read my article on Installing IIS 7. Now let’s start:
1. Open Server Manager.
2. In the left pane expand Roles and click Web Server (IIS), then in the center pane scroll down and click Add Role Services.

3. Next on the Select Role Services screen select CGI, under Application Development, then click Next.

4. Confirm Installation Selections by reviewing the options you picked and then click Install.

5. You should see Installation Succeeded on the Installation Results screen; go ahead and click Close.

6. You will now see the CGI role service under the IIS panel.

Now that wasn’t too bad was it? You will notice that you installed CGI instead of FastCGI, but by selecting CGI it enables both. Now let’s move on to installing PHP!
When dealing with PHP there are many different versions that are in use and depending on the application you are going to be using you may need a specific version. There are also repackaged versions like those from Zend that are pre-packaged and optimized extensions that work together.
If you want to use the official release you can get it from: http://www.php.net/downloads.php
For this demo I am going to use PHP 5.2.6 Non-thread-safe installer under Windows Binaries. It is recommended to use the non-thread safe build with IIS 7 since FastCGI will ensure single threaded execution environment.
Once you download it to your server let’s get started.
1. Left click on the PHP Installer Binary.

2. You will now see the PHP Setup Wizard window, go ahead and click Next.

3. On the End-User License Agreement, go ahead and place a check in the box accepting the terms in the License Agreement and then click Next.

4. Now select a destination folder, for our example I am going to use C:\PHP5\, type or navigate to where you want to install it and click Next.

5. Now select IIS FastCGI as the web server and click Next.

6. The Choose Items to Install screen is next. I am going to stick with the default, as adding extensions that you don’t need increases your vulnerability profile.
If you have need of an additional Extension just open up the drop down and choose it, then click Next.

7. Here comes the big moment! Click Install and watch the magic happen.

8. You should see the Setup Completion screen now. Go ahead and click Finish.

9. Ok, now we will have to make a few modifications to the way PHP handles itself so we are going to modify the php.ini file.
First navigate to the place you installed PHP and open php.ini in notepad.

10. First let’s modify fastcgi.impersonate and set it to 1. Remember you are going to have to uncomment these first and then change the value, and also CTRL+F is your friend!

11. Now find cgi.fix_pathinfo and set it to 1 also, remember to uncomment by removing ;

12. Next up is cgi.force_redirect and we are going to set this to 0, and uncomment.

13. Then let’s set open_basedir to the root level of our website content directory, which I will use the default C:\inetpub

14. Now save your changes to php.ini

That’s it! Let’s go ahead and test the install, by going to a command prompt and doing the following:
1. Open a command prompt.
2. Navigate to the directory you installed PHP to.
3. Type in: PHP –info and you should see a lot of scrolling and information. This means PHP is good to go.
Below is the start of the command and output, then the second picture is the last thing that will be shown.


You have now properly installed and tested PHP on the server. Now we have to configure IIS 7 to use PHP through FastCGI.
IIS7 can be configured to handle PHP mappings at server or site levels, but for this example we are going to set the configuration at the server level. This just basically tells the server how to handle files with .php type extensions.
1. Open IIS Manager and select the server in the left pane and then click on Handler Mappings in the center pane.

2. In the right Action pane select Add Module Mapping…

3. Fill out the following information and click OK:
Request Path: *.php
Module: FastCgiModule
Executable: {path to your PHP install}\php-cgi.exe
Name: Whatever you want

4. You will get a popup asking if you want to create a FastCGI application, go ahead and click Yes.

5. You will now see your enabled handler in the list.

You have now successfully setup your IIS7 web server to handle PHP files via FastCgi. But don’t take my word for it, let’s go ahead and run a test.
1. Navigate to the default site directory at C:\inetpub\wwwroot
2. Create a file called info.php and place the following in the file:
<?php phpinfo(); ?>
3. Open your browser and point it at http://localhost/info.php and you should see a PHP information page similar to this:

This shows a successful handling of PHP files by IIS7. You have now configured your server to run PHP via FastCGI on IIS7.
My next article in this series will talk about installing some of the more popular databases and applications that can use PHP. If you have any requests feel free to leave a comment.
Copyright © Train Signal Inc. All Rights Reserved.
miza Says:
September 11th, 2008 at 5:26 pm
Thanks a lot i realy like it.
Javier Says:
September 16th, 2008 at 4:51 pm
With this install, only the http:/localhost/*.php run, but if I want to run php in a site doesn’t work.
David Lawlor Says:
September 16th, 2008 at 6:17 pm
Javier-
What error are you seeing? If it runs in localhost, which is the default website, it should run in any other site on that server as long as you assigned the handler at the server level.
Let me know the exact error and we can work from there.
Dave
David Lawlor Says:
September 17th, 2008 at 9:43 am
Just so anyone reading this knows, I contact Javier through email and found that the error has cleared up for him so you are good to use this method to install :)
Sune Says:
September 18th, 2008 at 6:17 am
Great guide, but I seem to running in to a problem as well. I went through the guide two times and the php -info outputs fine, but when I call a PHP page through IIS it doesn’t work.
For example the info.php file just gets rendered as if it was html (i can see the php code if i view the source in my browser) while another PHP script returns “500 – Internal server error.”. It is as if the mapping doesn’t work correctly, any ideas on what to try?
David Lawlor Says:
September 18th, 2008 at 12:31 pm
Sune-
Use the contact form to send your email details to Kasia through the site and I will get in touch and see what is going on.
Make sure your handler for PHP is setup at the server or site level depending on where you need it.
Also enable logging and look at the 500 error on the other script, there is a chance you are calling a module that isn’t installed.
Dave
Nick Says:
September 22nd, 2008 at 1:08 pm
Dave,
Great tutorial, just what I needed!
I did all of the steps, and they appear to go pretty well.
php.info does not render html for some reason. Any hint will be greatful.
David Lawlor Says:
September 22nd, 2008 at 3:28 pm
Nick-
Are you getting an error for PHP.ini or is it just coming up as plain text? As above use the contact form to send in your details and I will get back to you to see what is going on.
Dave
João Says:
October 1st, 2008 at 5:02 am
Hi
I’ve followed the steps, info.php works fine but other script to users perform login no, it returns the 500 internal server error, as reported by other users. Any of those who got the error or the author of the article can explain me how they solved the problem?
Site is still not on-line until I solve that issue.
David Lawlor Says:
October 1st, 2008 at 10:21 am
Joao-
It really depends on the script. As was mentioned in the article, this is just a base install, different scripts require different extensions. Are all the necessary PHP extensions loaded for the script? You say you got a 500 error, is logging enabled so you can get an more clear error message?
Use the contact form to send your information to Kasia and I will try and help you through this. Please send the following at least:
Send script name
Enable logging and get a more precise error of what the 500 is triggering on
A list of all enabled PHP extensions.
Thanks,
Dave
Elena Says:
October 2nd, 2008 at 5:06 am
Hi Dave. Thank you for your article.
I did everything you said in the article, but when I tried to open my info.php in the browser it doesn’t show me the page you mentioned above. It just shows me the text: ‹?php phpinfo(); ?›.
What could caused that problem?
Thanks in advance.
Gary Davis Says:
October 11th, 2008 at 1:14 pm
If I go to http://webguild.dyndns.org/info.php, I get the HTTP 404 error. If I go to http://localhost/info.php from the server itself, I get
—–
HTTP Error 404.3 – Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Most likely causes:
* It is possible that a handler mapping is missing. By default, the static file handler processes all content.
* The feature you are trying to use may not be installed.
* The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
* If ASP.NET is not installed.
Things you can try:
* In system.webServer/handlers:
o Ensure that the expected handler for the current page is mapped.
o Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool.
o Pay extra attention to typographical errors in the expected handler line.
* Please verify that the feature you are trying to use is installed.
* Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe.
o To set a MIME type, use the following syntax: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']
o The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.
o For example, to add a MIME map for a file which has the extension “.xyz”: appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']
Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them.
* Install ASP.NET.
* Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
—-
I did get the data out from the php -info command line OK.
I verified the IIS 7 steps to add the handler. One thing that happened not mentioned in your detailed steps was that attempting to add E:\Program Files\PHP\php-cgi.exe resulted in a popup that said quotes are needed if there are spaces in the command (there aren’t but maybe it was complaining about the hyphen. Enclosing in quotes solved that request.
The handler is shown as enabled for *.php.
Any ideas on this?
Windows Server 2008 x86
Thanks,
Gary Davis
Gary Davis Says:
October 11th, 2008 at 2:40 pm
OK, I solved the problem of the 404.3.
First, I uninstalled PHP which was installed at E:\Program Files\PHP since I thought it may be a permissions problem. I Installed it at E:\PHP. This did not help, even when adding NETWORK SERVICE to the securities list.
When the Handler Mapping was added this time, it did not complain about the quotes.
I then re-added the Handler Mappings at the web site level (Default Web Site) since it did not show up there even though it was mapped at the server level.
Now, the Info.php ran!
Thanks,
Gary Davis
David Lawlor Says:
October 13th, 2008 at 10:01 am
Gary-
Thanks for the follow-up on your issue. The reason the handler wanted quotes is because of the space in “Program Files” since that is part of the path for your command line and while the Windows GUI handles the space ok, the command line would need the quotes.
I am surprised that adding the mapping at the server level did not get inherited by the default website. I will run a test on my server to see if I can replicate that issue.
Thanks again for your follow-up.
Dave
LIX Says:
October 15th, 2008 at 6:54 am
Elena and everybody who gets plain php code instead of correct result – symbols ” in this guide are replaced with some Unicode symbols which look a lot like them. Therefore php code won’t work, if you are trying to run code copy-pasted from this article. Some little nasty mistake.
LIX Says:
October 15th, 2008 at 6:57 am
It seems that engine of forum eats this symbols.
I meant greater-than sign > and less-than sign <
Colin Says:
October 20th, 2008 at 11:56 am
I followed it step by step and it’s didn’t work for me in windows server 2008
if I go to the http://localhost/info.php I get an HTTP 404 Not Found error…
David Lawlor Says:
October 20th, 2008 at 1:36 pm
Colin-
A 404 error should only be evident if your info.php file was not in the right location. Check the root path for your default website which should be by default:
%SystemDrive%\inetpub\wwwroot and make sure that the info.php file is found under that directory. If PHP was an issue you would have either seen only the text in the info.php file or gotten a 500 error.
If this is a server I could access send your information through the contact form on this site and I will contact you to see if I can give you a hand.
Dave
Wesley Says:
October 21st, 2008 at 8:55 pm
I too had the same issue, where the first php file I created (per the tutorial) did not render in my website directory. After hours of troubleshooting, I simply created another PHP file and that one runs fine, with the sample script copied and pasted. And still the original PHP file I created does not render. I verified the extention, made sure it was not a text file… it just won’t run. If I run it on the localhost, I get a 500 error by the way with that file, but not the new one I created. They are both in the same folder, appear to have the same permissions. Wierd.. but anyway.. this sounds like the same problem everyone else is having.
Wesley Says:
October 21st, 2008 at 8:57 pm
So maybe LIX is right.. although, I copied it straight into a text file from this site.. and I copied it from that text file to my new php file (which did work).. so I still don’t get it completely.. but it kinda makes sense.
Cal Says:
October 22nd, 2008 at 5:01 pm
I don’t know too much about php, MySQL, or server 2008, but I followed instructions from this site exactly. IIS7 and info.php worked fine. MySQL Command Line Client works fine. location of folders (C:\PHP5; C:\Program Files\MySQL) I am comfortable with SQL so I don’t need a GUI for it. I am trying to get php to connect to mySQL using the below code. I assume user and password are a user on the server. Is there some setting I’m missing or some file that needs to be moved? Below is the code:
IExplorer displays:
PHP Fatal error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\mySQL.php on line 5
Thanks ahead, any hint would be appreciated!
Cal Says:
October 22nd, 2008 at 5:03 pm
lol, sorry code disappered I took out the this time:
$user=”staff”;
$password=”notrealpassword”;
$database=”mysqldb”;
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=”CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))”;
mysql_query($query);
mysql_close();
David Lawlor Says:
October 22nd, 2008 at 5:09 pm
Cal-
Is the MySQL extension configured for PHP? Make sure the following line is uncommented out in your php.ini
extension=php_mysql.dll
Let me know if that works,
Dave
Cal Says:
October 22nd, 2008 at 7:39 pm
It didn’t make a difference. I tried “extension=php_mysql.dll” and “extension=mysql.dll” seperately followed with the php -info in the “PHP5″ directory. I’m wondering if maybe the user should be blank(”"), Administrator, or root? Thanks for the fast response! I’m wondering if I should redo the whole server following different instructions.
Cal Says:
October 22nd, 2008 at 9:26 pm
I found the “php.ini” file in the PHP5 folder and did not find extension=php_mysql.dll so I typed it in. Is there another “php.ini” file? If so where is it?
David Lawlor Says:
October 23rd, 2008 at 11:10 am
No there should only be one php.ini, it was the same one you modified in the article above.
I dont think it is a permission issue because the error is a PHP one and it is because the Mysql handler isnt functioning properly. You may need to restart the server to get the extension to take.
If you want to make sure rerun the installation above for PHP and in step 6 go into the dropdown for extensions and choose MySQL from the extensions.
I emailed you directly, feel free to contact me directly and I will post a summary on here when we figure it out.
Dave
Matthew Says:
November 12th, 2008 at 3:20 pm
Great guide…
one question though, using the .exe php installers, how can i add mysqli support, it seems it is listed under the php.ini file, but i have pages that wont work, i had them working under ISAPI module and by un-comment and copying dlls around.. but the installer has no dll to move around, should mysql / mysqli just work..
Matthew Says:
November 12th, 2008 at 3:23 pm
ignore that last one, silly me didnt choose the mysql items during the installer :)
tween Says:
November 19th, 2008 at 8:59 pm
Hi-
16 hours and no luck. 500 internal server error, 403 errors. Uninstalled, reinstalled php, mysql. PHP Info won’t run. Ran for most of the day until I reinstalled php 5.2.
.html files work, php files don’t. trying to install wordpress on server 2008. server has sharepoint on it. can’t take it off as I host sharepoint.
500 – Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
IIS handlers configured properly. default page set to index.php.
Any suggestions would be greatly appreciated.
P.
Calvin Says:
November 21st, 2008 at 9:09 am
Thanks for a Great guide.
Unfortunaltely PHP info runs on the default site, The Handler Mapping are there and carry over to the other sites but it will not run outside of the default on another site, I keep getting 500 – Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
I know other people have had this issue 500 issue, any hints or help would be greatly appreciated.
David Lawlor Says:
November 21st, 2008 at 9:34 am
Calvin -
Check the logs for the exact 500 error it should be more specific. Though what catches most people is that the new site directory is outside the directory specified in step 13 which is the open_basedir statement. All sites that you want to work with PHP have to fall under this top level directory. If you are using a directory outside what you placed in that path they will not work.
Let me know if that helps, or if you can find a more specific error.
Dave
Matthew Says:
December 29th, 2008 at 11:02 am
When I try to access http://192.168.0.88/info.php it works. When I try to access http://localhost/info.php it does not work. When it does not work I get a error 404.
When I access http://192.168.0.88/info.php remotely it works. However, when i just do http://192.168.0.88/ no site loades up I get an error 500.
Any ideas??
Matthew Says:
December 29th, 2008 at 12:10 pm
my logfile:
#Date: 2008-12-29 17:57:14
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2008-12-29 17:57:14 192.168.0.88 GET / – 80 – 192.168.0.25 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
2008-12-29 17:59:29 192.168.0.88 GET / – 80 – 192.168.0.25 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 187
2008-12-29 18:00:48 192.168.0.88 GET / – 80 – 192.168.0.16 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;+.NET+CLR+3.0.04506.648) 500 0 0 171
David Lawlor Says:
December 29th, 2008 at 4:49 pm
Matthew -
Ok let me ask a few more specifics to make sure I know exactly where you are at.
Ok so it works if you go directly to the info.php with a IP so we know it is working.
Since it doesnt work with localhost can you tell me how this server is setup? First did you create a new site for the PHP or are you using the default one? Does the server have more than one IP assigned to it?
For the remote answer it is more than likely your default document setting for the site. Make sure you have a default document there for the site. Or set your default document to info.php if you dont have any other documents setup right now.
Let me know how much that clears up and we can go from there.
Dave
Matthew Says:
December 30th, 2008 at 9:28 am
The server is a 2008 virtual server sitting on a 2008 server. It hosts AD/DNS/IIS. It is the primary AD/DNS but there is a secondary on the network as well and it’s all a member of a domain. As far as the virtual server goes, no it only knows there is one IP.
I have my default document set to index.php. I even renamed index.php to info.php and info.php to index.php and accessed http://192.168.0.88 and the phpinfo page showed up just fine.
I believe now that because of what i just mentioned there is something in my index.php that is holding me up. This site has been working for a few years and was working just fine on a IIS 6 (actually still is i’m just deploying a backup on iis 7). There is a mysql connection and the mysql is installed with the data populated and i can connect to it and see all the data just fine w/ sqlyog (sql browser).
I looked up error 500 0 0 171 (i believe) and it pointed to something about SMTP connection. My site does pass the password to our internal email but that resides on a remote linux box. Also, my connect script for mysql calls for locahost (remember i can’t connect to localhost) so i changed that to the IP instead but no luck.
Matthew Says:
December 30th, 2008 at 10:01 am
oh also, yes, i created a new site and am not using the default one nor am i using the default pool.
I tried to use them though and get the same results. they are both pointing to the same directory to use. (i stopped the default site/pool while trying to run the new site/pool)
Matthew Says:
January 1st, 2009 at 8:11 pm
I’ve stumped him!! :)
Matthew Says:
January 1st, 2009 at 9:09 pm
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2009-01-02 03:06:17 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:19 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
2009-01-02 03:06:19 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:19 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:19 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 250
2009-01-02 03:06:20 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
2009-01-02 03:06:20 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:20 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:20 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
2009-01-02 03:06:20 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 250
2009-01-02 03:06:22 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 218
2009-01-02 03:06:22 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
Matthew Says:
January 1st, 2009 at 10:42 pm
ok…uninstalled IIS7. Reinstalled IIS7 and PHP 5.2 as per the following step by step guide:
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/
(this looks identical to yours and i followed yours originally)
I still get the following errors:
2009-01-02 04:36:16 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 234
2009-01-02 04:36:16 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 187
2009-01-02 04:36:16 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 203
2009-01-02 04:36:16 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 203
2009-01-02 04:36:16 192.168.0.88 GET / – 80 – 68.229.237.116 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-US;+rv:1.9.0.5)+Gecko/2008120122+Firefox/3.0.5 500 0 0 187
if any advice please email hardwerk@gmail.com I really appreciate any info.
Matthew Says:
January 2nd, 2009 at 10:52 am
My site runs just fine on IIS 6. Is that because of ISAPI? Is there any reason my site would require ISAPI vs FastCGI?
dirt Says:
January 28th, 2009 at 2:28 pm
500 Error SOLUTION:
Add “IIS_WPG” group with +RXL permissions to C:\PHP5 directory
Mike Taylor Says:
February 5th, 2009 at 12:22 pm
Hello.
Thank you for well made document. I was nicely done.
I have Server 2008 and downloaded PHP 5.2.8. I followed your steps precisely, but I received a 404 error. Anyhow, I found the problem. My server settings, by default, was set to “hide extensions for known file types.” I unselected that option, removed the trailing .txt from the info.php file that was created, and there it worked.
I typically show file extensions, however; this being a fresh install of Server 2008, I didn’t get around doing that just yet. So naturally that error threw me into a loop.
After reading some of the responses, I just thought I mention that as I think some people may have ran into a similiar sistuation.
Mike
Installing PHP on Windows and IIS | David’s Technical Musings Says:
March 11th, 2009 at 6:10 pm
[...] IIS7: Install FastCGI & PHP on Server 2008 by Dave Lawlor [...]
Anthony Says:
March 16th, 2009 at 6:48 pm
Thanks for the help work 1st time was going crazy.
Shuoming Says:
March 24th, 2009 at 10:57 am
Thanks so much for all the information you put up there!
I installed php 5.3 nts x64 and Mysql 5 x64 on Windows 2008×64 (hardware and operatesysem)with ii7 configed fastcgi. They run individually fine. php -info tested good. But when installing moodle 1.9.4 I got error like this: HTTP error 500.0 – internal Server Error The page cannot be displayed because an internal server error has occurred. Detail Error Information:
Module FasModule: FastCgiModule
Notification: ExecuteRequestHandler
Handler: PHP via FastCGI
Error Code: 0×00000000
Requested URL: http://localhost:80/moodle/index.php
Physical Path :C:\inetpub\wwwroot\moodle\index.php
Logon Method :Anonymous
Logon User: Anonymous
Could you please take a look?
Amster Says:
March 31st, 2009 at 5:27 pm
Excellent tutorial mate. Worked for me on Vista+II7
Thank for taking the time out to share this information – you’re a good guy.
Now all I need to do is set up MySql on Vista! (need another walk through like this lol!)
Cheers
Steve Says:
April 4th, 2009 at 9:06 pm
So I installed PHP 5.2.6 on Server 2008 Web/IIS 7. I configured FastCGI as above.
My phpinfo.php works fine. I setup a PHP application (amiroCMS) all written in PHP and I was able to configure it, set it completely up, config a mysql DB etc. But when I get to the login page after the config and actually login I get an error:
HTTP Error 500.0 – Internal Server Error
There is a problem with the resource you are looking for, so it cannot be displayed
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP_via_FastCGI
Error Code 0×8007000d
Requested URL http://auctionmasters.com:80/amiro/_admin/index.php
Physical Path \www\AuctionMasters\amiro\_admin\index.php
Logon Method Anonymous
Logon User Anonymous
Nothing I do will make this error go away. I can render other php pages and phpinfo works fine, but for some reason it fails upon the actual login.
I also installed phpMyadmin for Mysql administration, and that ever works fine – I can create, modify delete db’s etc.
Ironically, MS has no info on the 0×8007000d error and no info on FastCGI errors.
Enabling PHP logging does nothing either.
Any input on the error or how to trace down what the cause it?
imperia Says:
April 8th, 2009 at 9:36 am
I’ve managed to fix 500.0 Internal server errors I was getting with default PHP Version 5.2.9-2 installation. Here is what I did. First I followed the guide above. Then I ran Command Prompt (with administrator rights). Then I ran php-cgi. I got errors like this:
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_mssql.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pdo_mssql.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pdo_oci.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pdo_oci8.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pdo_pgsql.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pdo_sqlite_external.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pgsql.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_pspell.dll’ – The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\ext\php_sybase_ct.dll’ – The specified module could not be found.
in Unknown on line 0
Run Notepad (with administrator rights) and open php.ini from C:\Program Files\PHP
Go to the end of the file. Stop php from loading the modules that you had error with. Remove each 2 lines with problem modules. Example
[PHP_MSSQL]
extension=php_mssql.dll
^^^^ remove both or comment with ;
Do this for each module that you got error with.
Save the ini file and run again php-cgi to see if you have fixed the errors.
Try running again your phpinfo.php script in your browser to see if its working.
I guess the right way to install php is to enable modules that you really need, not all of them. Maybe the errors are caused by bad “Module Settings” in php.ini file, because the actual .dll files are present in the \ext folder. So the error “The specified module could not be found.” is misleading.
I hope this helps. If you are still unable to make it work, I may post my php.ini settings here.
Good luck.
Daniel Grogan Says:
April 14th, 2009 at 7:16 am
Absolutely excellent, very easy to follow
mmkeebler Says:
April 16th, 2009 at 9:12 am
This method worked great for me. Thanks for the great tutorial.
Joseph Hillhouse Says:
June 2nd, 2009 at 5:47 pm
THANK YOU!!!!!! so much. I have tried everything and spend at least 12 hours on it installing from the zip package and the installer using fastcgi, cgi, and isapi script but it would always go wrong. Finally it works and I can connect to my database. I was almost ready to give up.
Max Says:
June 4th, 2009 at 5:39 am
Thank you for the super clear explanation! Worked on the first try, thanks!
new server « Citylights Says:
June 8th, 2009 at 1:16 am
[...] like to thank Dave Lawlor and his post for helping me to set up php and mysql. Of course its never as easy as it seems. I’ve had to [...]
Mbalthrop Says:
June 13th, 2009 at 12:45 pm
Thank you, this was exactly what i was looking for.
Lindsay Says:
June 18th, 2009 at 6:50 pm
Dave,
I read through this, and a whole bunch of other google results for the 500 internal server error.
I am still getting it.
specifically, whenever php tries to do anything with mysql
i can run phpinfo() in a script from a browser just fine.
if the only function in my php script is mysql_connect(), with proper credentials for mysql, i get the 500 error.
My problem here is that i am trying to help the windows server administrator figure this out. I am a *nix admin, not windows.
They are running windows server 2008. i think their environment _might_ be virtualized, but i am not sure.
Any ideas?
Henrik Hansen Says:
June 19th, 2009 at 4:53 pm
Hi Dave, at first i must say… rly rly nice work you do for help us out “out here in the world” :)
I have follow all your guides to get a windows server 2008 std, to work as IIS 7 whit PHP and mySQL whit phpmyadmin.
As faar all looking good – i mean, my phpinfo.php works fine – mySQL db works i can manage it by GUI tools, and phpmyadmin.
and it`s abit strange how to try explain the problems i do have – but i try:
exampel site:
1.) i do have the real site ( old server ) here: http://www.tinglev-bogtrykkeri.dk
- all works fine and includes and connections to mySQL works.
2.) i do have the same site ( on new server ) here: http://tinglev-bogtrykkeri.dk
- its look like the includes work, but don`t get the “my SQL data” on the site.
- when i try view source code, i can see the indcludes on the site, whit not are normaly.
On thats it`s seem like “php not work” – but when i try make a php info file on same “web site” http://tinglev-bogtrykkeri.dk/phpinfo.php – it`s show like it should work?
Do you or some have anny idea what`s wrong, and how to fix it?
- rly almost about to get crazy about it! :)
Thanks alot, Henrik
Johnny Burnette Says:
June 28th, 2009 at 10:23 pm
Nice job! You make it look so easy.