using fastcgi to host php applications on iis 7

24
Using FastCGI to Host PHP Applications on IIS 7.0 Author: Ruslan Yakushev Published on December 05, 2007 by IIS Team Updated on June 26, 2009 by IIS Team Average Rating Rate It (36) This article explains how to configure the FastCGI module and PHP to host PHP applications on IIS 7.0 IMPORTANT: This article provides instructions on how to install and use the FastCGI component on Windows Server 2008 and Windows Vista SP1. Please note: SP1 is required on Windows Vista. Table of Content Overview Enabling FastCGI support in IIS 7.0 o Windows Server 2008 o Windows Vista SP1 o Update for the FastCGI module o Administration Pack for IIS 7.0 Install and Configure PHP Configure IIS to handle PHP requests o Using IIS Manager o Using command line Best practices for configuring FastCGI and PHP o Security Isolation o Process recycling o PHP versioning o Security recommendations Per-site PHP configuration URL rewriting for PHP applications Related Resources Overview The FastCGI module in IIS enables popular application frameworks that support the FastCGI protocol to be hosted on the IIS web server in a high-performance and reliable way. FastCGI provides a high-performance alternative to the Common Gateway Interface (CGI), a standard way of interfacing external applications with Web servers that has been supported as part of the IIS feature-set since the very first release. CGI programs are executables launched by the web server for each request in order to process the request and generate dynamic responses that are sent back to the client. Because many of these frameworks do not support multi-threaded execution, CGI enables them to execute reliably on IIS by executing exactly one request per process. Unfortunately, it provides poor performance due to the high cost of starting and shutting down a process for each request. FastCGI addresses the performance issues inherent in CGI by providing a mechanism to reuse a single process over and over again for many requests. Additionally, FastCGI maintains compatibility with non-thread-safe libraries by providing a pool of reusable processes and ensuring that each process will only handle one request at a time. Enabling FastCGI Support in IIS 7.0 Windows Server 2008 Add the CGI role service by going to Server Manager -> Roles -> Add Role Services. This enables both the CGI and FastCGI services:

Upload: sebacruzar

Post on 30-Oct-2014

441 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Using Fastcgi to Host Php Applications on Iis 7

Using FastCGI to Host PHP Applications on IIS 7.0Author: Ruslan Yakushev

Published on December 05, 2007 by IIS Team Updated on June 26, 2009 by IIS Team

Average Rating Rate It (36)

This article explains how to configure the FastCGI module and PHP to host PHP applications on IIS 7.0

IMPORTANT: This article provides instructions on how to install and use the FastCGI component on Windows Server2008 and Windows Vista SP1. Please note: SP1 is required on Windows Vista.

Table of Content

Overview Enabling FastCGI support in IIS 7.0

o Windows Server 2008o Windows Vista SP1o Update for the FastCGI moduleo Administration Pack for IIS 7.0

Install and Configure PHP Configure IIS to handle PHP requests

o Using IIS Managero Using command line

Best practices for configuring FastCGI and PHPo Security Isolationo Process recyclingo PHP versioningo Security recommendations

Per-site PHP configuration URL rewriting for PHP applications Related Resources

Overview

The FastCGI module in IIS enables popular application frameworks that support the FastCGI protocol to be hosted on the IISweb server in a high-performance and reliable way. FastCGI provides a high-performance alternative to the CommonGateway Interface (CGI), a standard way of interfacing external applications with Web servers that has been supported aspart of the IIS feature-set since the very first release.

CGI programs are executables launched by the web server for each request in order to process the request and generatedynamic responses that are sent back to the client. Because many of these frameworks do not support multi-threadedexecution, CGI enables them to execute reliably on IIS by executing exactly one request per process. Unfortunately, itprovides poor performance due to the high cost of starting and shutting down a process for each request.

FastCGI addresses the performance issues inherent in CGI by providing a mechanism to reuse a single process over andover again for many requests. Additionally, FastCGI maintains compatibility with non-thread-safe libraries by providing a poolof reusable processes and ensuring that each process will only handle one request at a time.

Enabling FastCGI Support in IIS 7.0

Windows Server 2008

Add the CGI role service by going to Server Manager -> Roles -> Add Role Services. This enables both the CGI andFastCGI services:

Page 2: Using Fastcgi to Host Php Applications on Iis 7

Windows Vista SP1

Add the CGI feature by going to Control Panel -> Programs and Features -> Turn Windows features on or off. This enablesboth the CGI and FastCGI services.

Page 3: Using Fastcgi to Host Php Applications on Iis 7

IMPORTANT: Install the update for FastCGI module

The update for IIS 7.0 FastCGI module fixes several known compatibility issues with popular PHP applications. Install theupdate from one of the following locations:

Update for Windows Server 2008 Update for Windows Server 2008 x64 Edition Update for Windows Server 2008 for Itanium-based Systems Update for Windows Vista SP1 Update for Windows Vista SP1 for x64 based Systems

Install Administration Pack for IIS 7.0

NOTE: This step is optional.

Among other useful features Administration Pack for IIS 7.0 has a very convenient user interface for configuring FastCGIsettings. Administration Pack can be installed from these locations:

Administration Pack for IIS 7.0 - x86 Administration Pack for IIS 7.0 - x64

Install and Configure PHP

It is recommended to use a non-thread safe build of PHP with IIS 7.0 FastCGI. A non-thread safe build of PHP providessignificant performance gains over the standard build by not doing any thread-safety checks, which are not necessary, sinceFastCGI ensures a single threaded execution environment.

1. Download the latest non-thread safe zip package with binaries of PHP from http://www.php.net/downloads.php.2. Unpack the files to a directory of your choice (e.g. C:\PHP). Rename the php.ini-recommended to php.ini.3. Open the php.ini file, then uncomment and modify settings as follows:

o Set cgi.fix_pathinfo=1. cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.PHP's previous behavior was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not care whatPATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHPCGI to fix its paths to conform to the spec

o Set cgi.force_redirect = 0.o Set fastcgi.impersonate = 1. FastCGI under IIS supports the ability to impersonate security tokens of the

calling client. This allows IIS to define the security context that the request runs under.o Set fastcgi.logging = 0.o Set open_basedir to point to a folder or network path where the content of the web site(s) is located.o Set extension_dir to point to a location where PHP extensions reside. Typically, for PHP 5.2.X that would

be set as extension_dir = "./ext"o Set date.timezone = Asia/Bangkok to work in Thailand location.o Enable the required PHP extension by un-commenting corresponding lines, for example:

extension=php_mssql.dllextension=php_mysql.dll

4. To test if the PHP installation is successful, run the following from the command line prompt:

C:\PHP>php –info

If PHP was installed correctly and all its dependencies are available on the machine, then this command will output thecurrent PHP configuration information.

Configure IIS 7.0 to Handle PHP Requests

In order for IIS 7.0 to host PHP applications, it is necessary to add a handler mapping that tells IIS to pass all PHP specificrequests to the PHP application framework via FastCGI protocol.

Page 4: Using Fastcgi to Host Php Applications on Iis 7

Using IIS Manager

Open IIS Manager and then select and open “Handler Mappings” at the server level:

Select the “Add Module Mapping” action and specify the configurations settings as below:

Page 5: Using Fastcgi to Host Php Applications on Iis 7

Request path: *.php Module: FastCgiModule Executable: "C:\[Path to your PHP installation]\php-cgi.exe" Name: PHP via FastCGI

Click OK. A dialog box appears asking if you want to create a FastCGI application for this executable. Click Yes.

Test that the handler mapping works correctly by creating a phpinfo.php file in the C:\inetpub\wwwroot folder that containsthe following code:

<?php phpinfo(); ?>

Page 6: Using Fastcgi to Host Php Applications on Iis 7

Open a browser and navigate to http://localhost/phpinfo.php. If everything was setup correctly, then you will see the standardPHP information page:

NOTE: If you do not see "FastCgiModule" in the "Modules:" drop-down list then it means that the module is not registered ornot enabled. To check if FastCGI module is registered open the IIS configuration file%WINDIR%\windows\system32\config\applicationHost.config and check that the following line is present in <globalModules>section:

<add name="FastCgiModule" image="%windir%\System32\inetsrv\iisfcgi.dll" />

Also, in the same file, check that the FastCGI module is added to the <modules> section:

<add name="FastCgiModule" />

Using command line

Alternatively, the above mentioned steps can be completed by using command line tool appcmd.

To create the FastCGI application process pool, run the following command:

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\{php_folder}\php-cgi.exe']

After that, create the handler mapping:

Page 7: Using Fastcgi to Host Php Applications on Iis 7

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers/+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\{php_folder}\php-cgi.exe',resourceType='Unspecified']

Note: If you are using PHP version 4.X, instead of php-cgi.exe, you can use php.exe.

Best Practices for Configuring FastCGI and PHP

This download contains a summary presentation on Best Practices for hosting PHP in a shared hosting environment.

Security Isolation for PHP Web Sites

The recommendation for isolating PHP web sites in a shared hosting environment is consistent with all general securityisolation recommendations for IIS 7.0. In particular, it is recommended to:

Use one application pool per web site Use a dedicated user account as an identity for the application pool Configure anonymous user identity to use the application pool identity Ensure that FastCGI impersonation is enabled in the php.ini file (fastcgi.impersonate=1)

For more details about security isolation in a shared hosting environment, refer to Isolating Sites with Application Pools.

PHP Process Recycling Behavior

Make sure that FastCGI always recycles the php-cgi.exe processes before the native PHP recycling kicks in. The FastCGIprocess recycling behavior is controlled by the configuration property instanceMaxRequests. This property specifies howmany requests the FastCGI process will process before recycling. PHP also has a similar process recycling functionality thatis controlled by an environment variable PHP_FCGI_MAX_REQUESTS. By setting instanceMaxRequests to be smaller orequal to PHP_FCGI_MAX_REQUESTS, you can ensure that the native PHP process recycling logic will never kick in.

The FastCGI settings can be configured either by using IIS Manager or by using the command line tool appcmd.

Using IIS manager

To configure FastCGI recycling settings by using IIS Manager, you need to install Administration Pack for IIS 7.0 and thenselect FastCGI settings at the server level:

Page 8: Using Fastcgi to Host Php Applications on Iis 7

Next select the FastCGI application that you want to configure and click "Edit..." in the Actions pane on right hand side:

Page 9: Using Fastcgi to Host Php Applications on Iis 7

In the "Edit FastCGI application" dialog, set instanceMaxRequest to 10000 and then click on the browse button next to theEnvironmentVariables setting:

Page 10: Using Fastcgi to Host Php Applications on Iis 7

Add the PHP_FCGI_MAX_REQUESTS environment variable and set its value to 10000:

Note: If you do not configure these settings, then the following default settings are used: instanceMaxRequests = 200,PHP_FCGI_MAX_REQUESTS = 500 (on most PHP builds).

Using command line

To configure the recycling behavior of FastCGI and PHP via appcmd, use the following commands:

Page 11: Using Fastcgi to Host Php Applications on Iis 7

C:\>%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='c:\{php_folder}\php-cgi.exe'].instanceMaxRequests:10000

C:\>%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='C:\{php_folder}\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']"

PHP Versioning

Many PHP applications may rely on functions or features available only in certain versions of PHP. If such applications are tobe hosted on the same server then different PHP versions must be enabled and running side-by-side. The IIS 7.0 FastCGIhandler fully supports running multiple versions of PHP on the same web server.

For example, let’s assume that on your web server you plan to support PHP 4.4.8, PHP 5.2.1 and PHP 5.2.5 non-threadsafe. To enable that, you must place corresponding PHP binaries in separate folders on the file system (e.g. C:\php448\,C:\php521\ and C:\php525nts) and then create FastCGI application process pools for each version:

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php448\php.exe']

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php521\php-cgi.exe']

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php525nts\php-cgi.exe']

Now, if you have 3 web sites (site1, site2, site3), where each site needs to use a different PHP version, you can definehandler mappings on each of those sites to reference a corresponding FastCGI application process pool.

Note: Each FastCGI process pool is uniquely identified by a combination of fullPath and arguments properties.

C:\>%windir%\system32\inetsrv\appcmd set config site1 –section:system.webServer/handlers/+”..[name=’PHP448_via_FastCGI’,path=’*.php’,verb=’*’,modules=’FastCgiModule’,scriptProcessor=’c:\php448\php.exe’,resourceType=’Either’]

C:\>%windir%\system32\inetsrv\appcmd set config site2 –section:system.webServer/handlers/+”..[name=’PHP521_via_FastCGI’,path=’*.php’,verb=’*’,modules=’FastCgiModule’,scriptProcessor=’c:\php521\php-cgi.exe’,resourceType=’Either’]

C:\>%windir%\system32\inetsrv\appcmd set config site3 –section:system.webServer/handlers/+”..[name=’PHP525nts_via_FastCGI’,path=’*.php’,verb=’*’,modules=’FastCgiModule’,scriptProcessor=’c:\php525nts\php-cgi.exe’,resourceType=’Either’]

PHP Security Recommendations

The following settings can be used to tighten the security of a PHP installation. To make the recommended changes locateand open the php.ini file and edit the configuration settings as described below:

Setting Description

allow_url_fopen=Offallow_url_include=Off

Disable remote URLs for file handling functions, which may cause code injectionvulnerabilities.

register_globals=Off Disable register_globals.

open_basedir="c:\inetpub\" Restrict where PHP processes can read and write on a file system.

safe_mode=Offsafe_mode_gid=Off Disable safe mode

max_execution_time=30max_input_time=60 Limit script execution time

memory_limit=16Mupload_max_filesize=2M Limit memory usage and file sizes

Page 12: Using Fastcgi to Host Php Applications on Iis 7

post_max_size=8Mmax_input_nesting_levels=64

display_errors=Offlog_errors=Onerror_log="C:\path\of\your\choice"

Configure error messages and logging

fastcgi.logging=0IIS FastCGI module will fail the request when PHP sends any data on stderr byusing FastCGI protocol. Disabling FastCGI logging will prevent PHP from sendingerror information over stderr, and generating 500 response codes for the client.

expose_php=Off Hide presence of PHP

Enabling per-site PHP configuration

The section describes the recommended way of enabling per-site PHP configuration . Note that this recommendation wasdiscovered and validated by Radney Jasmin with hosting provider GoDaddy.com who now offers PHP hosting on WindowsServer 2008 via FastCGI.

Per-site PHP process pools

When each web site has its own application pool (which is a recommended practice on IIS 7.0), it is possible to associate adedicated FastCGI process pool with each web site. A FastCGI process pool is uniquely identified by the combination offullPath and arguments attributes. So, if it is necessary to create several FastCGI process pools for the same processexecutable, such as php-cgi.exe, the arguments attribute can be used to distinguish process pools definitions. In addition,with php-cgi.exe processes the command line switch "-d" can be used to define an INI entry for PHP process. This switchcan be used to set a PHP setting that makes the arguments string unique.

For example, if there are two web sites "website1" and "website2" that need to have their own set of PHP settings, theFastCGI process pools can be defined as follows:

<fastCgi> <application fullPath="C:\PHP\php-cgi.exe" arguments="-d open_basedir=C:\Websites\Website1" /> <application fullPath="C:\PHP\php-cgi.exe" arguments="-d open_basedir=C:\Websites\Website2" />

</fastCgi>

In this example the PHP setting open_basedir is used to distinguish between process pool definitions. In addition it enforcesthat the PHP executable for each process pool can perform file operations only within the root folder of the correspondingweb site.

Then website1 can have the PHP handler mapping as follows:

<system.webServer> <handlers accessPolicy="Read, Script">

<add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe|-d open_basedir=C:\Websites\Website1" resourceType="Unspecified" requireAccess="Script" />

</handlers></system.webServer>

and website2 can have the PHP handler mapping as follows:

<system.webServer> <handlers accessPolicy="Read, Script">

<add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe|-d open_basedir=C:\Websites\Website2" resourceType="Unspecified" requireAccess="Script" />

</handlers></system.webServer>

Page 13: Using Fastcgi to Host Php Applications on Iis 7

Specifying php.ini location

When the PHP process starts it determines the location of the configuration php.ini file by using various settings. The PHPdocumentation provides detailed description of the PHP start up process. Note that one of the places where PHP processsearches for php.ini location is the PHPRC environment variable. If PHP process finds a php.ini file in the path specified inthis environment variable then it will use it, otherwise it will revert to default location of php.ini. This environment variable canbe used to allow hosting customers to use their own versions of php.ini files.

For example if there are two websites: website1 and website2; located at the following file paths: C:\WebSites\website1 andC:\WebSites\website2 then the php-cgi.exe process pools in the <fastCgi> section of applicationHost.config can beconfigured as below:

<fastCgi> <application fullPath="C:\PHP\php-cgi.exe" arguments="-d open_basedir=C:\Websites\Website1">

<environmentVariables> <environmentVariable name="PHPRC" value="C:\WebSites\website1" />

</environmentVariables> </application> <application fullPath="C:\PHP\php-cgi.exe" arguments="-d open_basedir=C:\WebSites\Website2">

<environmentVariables> <environmentVariable name="PHPRC" value="C:\WebSites\website2" />

</environmentVariables> </application>

</fastCgi>

This way website1 can have its own version of php.ini in the C:\WebSites\website1, while website2 can have its own versionof php.ini located in C:\WebSites\website2. This configuration also ensures that if there is no php.ini found in locationspecified by PHPRC environment variable then PHP will fall back to using the default php.ini file located in the same folderwhere php-cgi.exe is located.

Providing URL rewriting functionality for PHP applications

The majority of popular PHP applications rely on the URL rewriting functionality in web servers to enable user friendly andsearch engine friendly URL's. IIS 7.0 provides URL rewriting capabilities via the URL rewrite module.

Refer to the following articles for more information on how to use the URL Rewrite Module:

Microsoft URL Rewrite Module Walkthroughs. Describes how to use the URL Rewrite Module Microsoft URL Rewrite Module configuration reference. Explains the functionality of the module and provides

descriptions of all configuration options. Configuring popular PHP application to work with the URL Rewrite Module:

o WordPresso MediaWikio b2Evolutiono Mamboo Drupal

Related resources

For more information regarding hosting PHP applications on IIS refer to the following resources:

Popular PHP applications on IIS Configuring FastCGI extension for IIS 6.0 Using FastCGI extension to host PHP on IIS 6.0 Installing FastCGI support on Windows Server 2008 Core

Related Content

Page 14: Using Fastcgi to Host Php Applications on Iis 7

Articles

Setting up FastCGI for PHP Installing PHP on Windows Vista with FastCGI Installing FastCGI Support On Server Core PHP Questions

Comments

1. Submitted on May 26 2008 byradirk Hello,setup was easy enough and I get the phpinfo.php page displayed just fine. However, upon runningC:\>%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /+[fullPath='c:\php\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS', value='10000']I get this:ERROR ( message:Cannot find SITE object with identifier "value='10000']". )

Please advise.Thanks!

Dirk2. Submitted on May 29 2008 by

GISDOTNET I also receive the same error as Dirk. Is there a solution? Thanks, Aaron.3. Submitted on May 29 2008 by

GISDOTNET I forgot to mention that I am running Vista SP1 and PHP 5.2.6. Thanks, Aaron.4. Submitted on May 29 2008 by

cameronward I get to the point to where I'm typing php>php -info and all that comes back to me is "Access isdenied".

Where do I go from there?5. Submitted on May 29 2008 by

cameronward I'm working with server 2008.6. Submitted on May 29 2008 by

GISDOTNET cameronward,

I actually had similar, yet not the exact issue, and had to run CMD as Administrator even though my account is in theadministrator group. I have noticed that this needs to be done on other things as well within Vista and 2008.

Hope this helps,

Aaron7. Submitted on Jun 13 2008 by

ntgt13 I got the same error but resolved it by removig the space between the , and the value='10000'.,*space*value='10000' -> ,value='10000']

8. Submitted on Jun 15 2008 byHybrid SyntaX hithanks for your tutorial i made PHP work on vista finally !but i have some problems ...

1.i couldn't use any of those commands ...2.i couldn't find any fastcgi module ! it was "CGI Module" for me ...3.when i open my php page it shows what i've entered but there're some garbages along ...it's like 15+ line and they are like this

"specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamiclibrary 'C:\PHP\ext\php_radius.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning:PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_rar.dll' ... "

i've installed PHP 5.2.6 on C:\PHP and i'm using Vista x64is that usual or i did something wrong ?

Page 15: Using Fastcgi to Host Php Applications on Iis 7

9. Submitted on Jun 17 2008 byscotteredu After some fiddling I was able to get it to work, mostly.

I am using PHP/MYSQL on my Vista box to demo so CMS products and when I go to install I get this:PHP Warning: session_start() [function.session-start]: open_basedir restriction in effect. File(C:\Windows\TEMP\) isnot within the allowed path(s): (c:\local) in C:\local\install\index.php on line 10 PHP Fatal error: session_start()[function.session-start]: Failed to initialize storage module: files (path: ) in C:\local\install\index.php on line 10

I think this is related to the 'open_basedir' line in the config steps above. Removing the reference to my website dir(c:\local) allows the install of the first CMS am testing to carry on.

My qestion is, first how unsecure is it to not have that line confi'd and second, if I do configure it like I did before -what else do I need to add to elminate the error?

very informative write up. Thanks.s

10. Submitted on Jun 24 2008 byruslany The open_basedir is a security protection measure which is useful when the PHP scripts that you deploy onyour server are not trusted. For example, this is important to use in shared hosting scenarios. If you know what yourscript does then you may turn off this setting. Or, alternatively you can configure the PHP session.save_path settingto use file path that is within the scope of the open_basedir restriction.

11. Submitted on Jul 02 2008 byericandrews This is a well written article, thank you. I am running Vista Ultimate with SP 1. When following theseinstruction I do not have the option to choose FastCgiModule. I followed these instructions, have CGI chose as anoption but there is no option to choose FastCgiModule. Any ideas on why it isn't showing up?

Thanks,Eric

12. Submitted on Jul 07 2008 byruslany When you enable CGI option, that will also install FastCGI module. You can check if the module is installedby going to IIS manager -> server node -> Modules.

13. Submitted on Jul 13 2008 bypatrickneal3 I have followed these directions to a t, and i get nuthing no info page no feedback from commandprompt, I had the subsite sat up when i starded this process is that why it is not working

Default web>site>site>site with php content

I have windows vista service pack 1 installed

please help!!!14. Submitted on Jul 30 2008 by

jetjaguar I was getting the same error as many others when configuring the FastCGI Recycling Behavior... Thanksntgt13 for catching that extra space.

I also have to say how impressed I am by the accuracy and usefulness of this article (considering that it's a"Microsoft" article). Thanks IIS Team.

15. Submitted on Aug 09 2008 byali.engin Thanks, I've installed my php following these instructions and it worked perfectly except that I can't run mypages like?phpinfo();?>

I must write it that way?phpphpinfo();?>

It also doesn't let me to use ?='Hello World!'?> syntax, it must be like?php print 'Hello World!'?> but I've many sites and codes written that way while I was using apache.

Page 16: Using Fastcgi to Host Php Applications on Iis 7

Can anybody help about that? Also I don't remember that kind of problem in IIS6. May it be because of my php.iniconfiguration?

16. Submitted on Aug 09 2008 byali.engin Can I edit my first message? It was my mistake, there was an option in php.ini named short_open_tag andit should be on to use the syntax that I mentioned.

17. Submitted on Aug 18 2008 byjawmusic I have the same problem as Eric. I installed Vista SP1, and enabled CGI but there is no mention of aFastCGI module in the modules listing. When I try to configure the handler I get an error saying that the FastCGIModule does not exist. Suggestions?

18. Submitted on Aug 20 2008 byruslany Can you check if the following file exists on the file system: %WINDIR%\system32\inetsrv\iisfcg.dll?

19. Submitted on Aug 21 2008 byjawmusic It's not there. I take it it should be? Any recommendations to solve this? I've tried to install FastCGIseparately, but it does not recognize a valid installation of Windows (I forget the exact error, but I assume it'sbecause the installer is looking for something other than Vista since it's part of SP1).

20. Submitted on Aug 21 2008 byjawmusic It's not there. I take it it should be? Any recommendations to solve this? I've tried to install FastCGIseparately, but it does not recognize a valid installation of Windows (I forget the exact error, but I assume it'sbecause the installer is looking for something other than Vista since it's part of SP1). Thanks for your help.

21. Submitted on Aug 29 2008 bychris davies To be honest,I've tried every tutorial I can find on how to install php5 and configure it with IIS7 to noavail. I must be missing something here. I have installed PHP5/MySQL5 etc on my XPPro setup which works fine,but I just bought a new laptop which runs Windows Vista Business. I installed IIS7, which worked fine until Iattempted to install PHP and now its gone all pear (excuse the pun) shaped. Any advice gratefully recieved.

22. Submitted on Sep 09 2008 bydoc-cafein Hi everyone, I've a Vista32 ultimate SP1 with all the IIS sevices and modules installed including CGI. I'vealso installed the last PHP 5.2.6. However, like jawmusic, I don't have any FastCGI module installed and can't addthe relevant module mapping. Meanwile, both the files iiscfg.dll and iisfcgi.dll are present in the%WINDIR%\system32\inetsrv\ but there is no iisfcg.dll file. What should I do to have the FastCGI module availablewith IIS? Thanx in advance for any help since I've a project to develop with it. When using the CGI.exe module Vs.FastCGI I receive the following error when I try "http:\\localhost\phpinfo"

Erreur HTTP 502.2 - Bad GatewayL'application CGI spécifiée n'a pas renvoyé le jeu complet d'en-têtes HTTP. Les en-têtes effectivement retournéssont "PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_oci8.dll' - Lemodule spécifié est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library'C:\Program Files\PHP\ext\php_pdo_oci.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning:PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_oci8.dll' - Le module spécifié estintrouvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_pdo_pgsql.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHPStartup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_sqlite_external.dll' - Le module spécifiéest introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_pgsql.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHP Startup:Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pspell.dll' - Le module spécifié est introuvable. inUnknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_sybase_ct.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHPStartup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_ibm_db2.dll' - Le module spécifié estintrouvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_ifx.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHP Startup:Unable to load dynamic library 'C:\Program Files\PHP\ext\php_ingres2.dll' - Le module spécifié est introuvable. inUnknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_maxdb.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHP Startup:Unable to load dynamic library 'C:\Program Files\PHP\ext\php_mcve.dll' - Le module spécifié est introuvable. inUnknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_netools.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHPStartup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_oracle.dll' - Le module spécifié estintrouvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\ProgramFiles\PHP\ext\php_pdo_ibm.dll' - Le module spécifié est introuvable. in Unknown on line 0 PHP Warning: PHPStartup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_informix.dll' - Le module spécifié estintrouvable. in Unknown on line 0 Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): Atline 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none)

Page 17: Using Fastcgi to Host Php Applications on Iis 7

Cannot find module (SNMPv2-MIB): At line 0 in (none) Cannot find module (SNMPv2-SMI): At line 0 in (none)Cannot find module (U

23. Submitted on Sep 10 2008 bynakedintherain For those having problems locating fastcgi.The problem lies in the PHP install.Do not use the windows PHP self installer download, if you have already installed PHP via the self installer, un-installit.Download the windows PHP ZIP file.Then extract all files to a directory of your choice, such as C:\ or where ever.Now if you look in the PHP folder you will see the fastcgi file.Scroll to "related Content" (just above these comments), click on the "Setting up FastCGI for PHP" link and downloadthe WMV file...everything is explained for you.good luck.

24. Submitted on Sep 10 2008 bynakedintherain My first post is wrong, sorry.Solution to fastcgi problem... http://learn.iis.net/page.aspx/375/setting-up-fastcgi-for-php/Download the WMV file.Follow it and your problems should be solved.That,s all i should have said in the first post.good luck.

25. Submitted on Sep 17 2008 bymsanda_77 One thing the article fails to point out, and will help with people trying to use oracle is that if you arerunning on a x64 based system YOU MUST DOWNLOAD the PHPX64 binaries. or you will get errors.

since php.net does not compile or create these x64 bit versions you have to get them form other sites. presentlyhttp://www.fusionxlan.com/PHPx64.php offers these files.

Please note installation is the same process as described above.

Hope this helps someone as i was tearing my hair to figure this out..26. Submitted on Sep 17 2008 by

msanda_77 One thing the article fails to point out, and will help with people trying to use oracle is that if you arerunning on a x64 based system YOU MUST DOWNLOAD the PHPX64 binaries. or you will get errors.

since php.net does not compile or create these x64 bit versions you have to get them form other sites. presentlyhttp://www.fusionxlan.com/PHPx64.php offers these files.

Please note installation is the same process as described above.

Hope this helps someone as i was tearing my hair to figure this out..27. Submitted on Sep 24 2008 by

davcox If you're on Vista SP1 and want to manage your FastCGI settings through the UI, then you'll need todownload the IIS Admin pack. Sorry for the confusion; I'll work to get this article updated.

http://www.iis.net/downloads/default.aspx?tabid=34&i=1683&g=6

Dave28. Submitted on Sep 24 2008 by

shinshi360 FYI - READ THIS!

At the end of this article, there is an appcmd to set PHP_FCGI_MAX_REQUESTS to 10000. Beware of simplycopying and pasting the appcmd line used to set the environment variable for PHP_FCGI_MAX_REQUESTS.

1) As someone already mentioned, removing the extra space between the name and value parameters will allow thecommand to succeed. BUT:

2) If you look closely, the single-quote character used to delimit PHP_FCGI_MAX_REQUESTS is an actual singleclose quote (’) and not a keyboard apostrophe (') as needed by appcmd. The command will succeed but appcmdincorrectly parses the command line. If your console window uses the default system font, they look exactly thesame. The snippet below is the result of the issue:

C:\>%windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgisystem.webServer>

Page 18: Using Fastcgi to Host Php Applications on Iis 7

fastCgi>application fullPath="C:\php\php-cgi.exe" instanceMaxRequests="10000">environmentVariables>environmentVariable name="10000" />/environmentVariables>/application>/fastCgi>/system.webServer>

Note how name is "10000" and not "PHP_FCGI_MAX_REQUESTS". This is clearly useless.

If you discover that you have this silent error in your configuration, you can edit your%windir%\system32\inetsrv\config\applicationHost.config file to change

environmentVariable name="10000" />

into

environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />

or follow the commands below:

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /-[fullPath='c:\php\php-cgi.exe'].environmentVariables.[name='10000']

%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /+[fullPath='c:\php\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']

If the configuration has been updated correctly, you should see an entry for PHP_FCGI_MAX_REQUESTS set to10000 in your phpinfo under the Environment section.

Feel free to delete this comment if the article has been updated and this is no longer needed!29. Submitted on Oct 06 2008 by

ruslany Shinshi360, thanks for finding the error in the appcmd command! I have updated the article with the correctappcmd syntax.

30. Submitted on Oct 15 2008 byJohn_Scanlon Thanks to all you gurus for never answering the question about not finding the fastcgi module onVista SP1. Though thank you ruslany, without your almost accurate question about a iisfcg.dll file (it should beissfcgi.dll), I never would have worked this out. What the answer to the missing Fast CGI module seems to be (andI'm a novice, but I can display the phpinfo in IE7, and my machine hasn't crashed), is that if you don't have aFastCgiModule available in the "Handler Mappings" dialogue, you need to 1) go into "Modules" dialogue at the sameserver level, 2) Choose the "Configure Native Modules" option on the right pane, 3) Choose "Register" on the nextwindow, and 4) on the following window, insert "FastCgiModule" in the Name textbox and"c:\windows\system32\inetsrv\iisfcgi.dll" in the Path textbox (use the navigate option to protect against your windowsand system directory names being different than mine). Finish configuring this native module, and then the rest ofthe instructions in this otherwise well written article should work.

31. Submitted on Oct 16 2008 byruslany Hi John_Scanlon, sorry for not getting back to you on your question. I am glad you have worked it out. Weare revising this article and I will make sure to include the steps you described about registering FastCGI module.

32. Submitted on Oct 16 2008 byruslany Also, in future please post your questions to these forums - http://forums.iis.net/1104.aspx,http://forums.iis.net/1103.aspx, http://forums.iis.net/1102.aspx. That way you should get a quicker response.

33. Submitted on Oct 17 2008 bysubcientifico If you want to use XDebug or DBG, then you need the thread safe version of PHP.

34. Submitted on Nov 14 2008 byjoyann Regarding fastcgi not showing up in module dropdown.If you already have CGI enabled when installing service pack 1 for Vista, fastcgi does not get enabled. Must turn itoff, reboot and then turn it back on. After a two hour hunt, I found this.... "Microsoft Windows Service Pack 1 doesnot automatically enable the FastCGI module for already installed IIS. To enable it, turn the CGI feature off, and thenturn it on again."http://www.witsuite.com/support/knowledge-base/manual-installation/install-iis-fastcgi.php#enable-iis-cgi-feature

Page 19: Using Fastcgi to Host Php Applications on Iis 7

35. Submitted on Dec 16 2008 bydavid.s Just a note for others that may encounter this problem. IIS7 is apparently not compatible with running PHPapps like WordPress or MediaWiki in wwwroot due to a problem with retrieving path information using functions likerealpath(). They run fine in subdirectories.

36. Submitted on Dec 18 2008 bycoreygo Also this guide suggests using the ZIP package of PHP to install. Because of this when I first set upFastCGI with PHP I ran into this: http://forums.iis.net/t/1149374.aspx. I ran into this page:http://www.thewebhostinghero.com/tutorials/windows2008-iis7-fastcgi-php.html. Which actually noted that a registryentry should be added for PHP: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\PHP. After I createdthis, I got the Hello World and PHPInfo pages to run correctly.

37. Submitted on Jan 01 2009 byfestuc I will be great to have a guide on how to do:

Use one application pool per web site

Use a dedicated user account as an identity for the application pool

Configure anonymous user identity to use the application pool identity

Thanks38. Submitted on Jan 09 2009 by

ruslany david.s IIS7 can run fine with WordPress and MediaWiki in wwwroot. Here is an example: http://ruslany.net.39. Submitted on Jan 09 2009 by

ruslany coreygo. If you look at the phpinfo.php output in this tutorial(http://www.thewebhostinghero.com/tutorials/windows2008-iis7-fastcgi-php.html) you will see that the loaded php.inipath is C:\php\php.ini. This is where the php configuration is loaded from by default when using fastcgi. You canchange this path by using the registry entry, but much less invasive way of changing it is to define an environmentvariable PHPRC for a fastcgi process pool:environmentVariables>environmentVariable name="PHPRC" value="C:\My\Location\To\phpini\" />/environmentVariables>This way the environment variable will be set only for the php-cgi.exe executable.

40. Submitted on Jan 19 2009 byLonestarjack I am using Vista SP1 and PHP5.2.8I am trying to use FastCGI. I have reloaded Windows features.Installed updates and Admin pack.Changed the PHP.ini and deleted all other copies of the PHP.ini file.Changed the Handler mappings.When I try an run phpinfo() I keep getting500.21 for a "bad module IsapiModule in its module list".Do I need ASP.NET?

41. Submitted on Jan 31 2009 byAntG Hi, First, thanks for a really helpful and clear article. With your guidance I have fully installed PHP on IIS and Ihad a working installation with a single php.ini. However I want a per-site configuration. I have three sites on myVista Ultimate/IIS 7.0 machine each with their own root and pool. After some trial and error I think I have theapplicationHost.config file in good shape - with the code that you give for "website1", "website2" etc modified andinside separate location> tags. My outstanding problem is that only one web site works, the other two return 503"Service Unavailable" and I can't see any unintended differences between the one that works and the two that don't.Any ideas please! I have run out.

42. Submitted on Feb 02 2009 byAntG Ha! had it right - just needed to refresh IIS. Thanks again for your clarity.

43. Submitted on Feb 13 2009 bymenkes Using Vista Ultimate 32-bit SP1, IIS 7, PHP 5.2.8Used zipped, thread-safe version of PHPModified php.ini as aboveAdded c:\php to PATH environment variableAdded registry key to point to php.ini file (I like it in c:\php rather than windows dir)Granted full access to c:\php for IUSRAdded php Handler as above (verified 10+ times that all spelled and entered correctly) pointing to c:\php\php-cgi.exeRun phpinfo() from command line and all is good

BUT....

Page 20: Using Fastcgi to Host Php Applications on Iis 7

When I run the file containing phpinfo() in the browser, 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 ahandler. If the file should be downloaded, add a MIME map."

Module: StaticGileModuleNotification: ExecuteRequestHandlerHandler: StaticFileError Code: 0x80070032Requested URL: http://localhost:80/php_info.phpPhysical Path: C:\inetpub\wwwroot\php_info.phpLogon Method: AnonymousLogon User: Anonymous

Any help would be appreciated.44. Submitted on Feb 16 2009 by

alexandre.madurell Hi everyone... I was running into the same issue as Lonestarjack... I finally got it working bychanging the managed handlers parameters to:

# Request path: *.php# Module: CgiModule# Executable: "C:\[Path to your PHP installation]\php-cgi.exe"# Name: PHP_via_CGI

I hope this helps. Thanks for the article!!!45. Submitted on Feb 17 2009 by

whiplondon when trying to run this code..

[CODE]?php// Configuration - Your Options$allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation.$max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB).$upload_path = 'c:\inetpub\wwwroot\bc\files'; // The place the files will be uploaded to (currently a 'files' directory).

$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.

// Check if the filetype is allowed, if not DIE and inform the user.if(!in_array($ext,$allowed_filetypes))die('The file you attempted to upload is not allowed.');

// Now check the filesize, if it is too large then DIE and inform the user.if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)die('The file you attempted to upload is too large.');

// Check if we can upload to the specified path, if not DIE and inform the user.if(!is_writable($upload_path))die('You cannot upload to the specified directory, please CHMOD it to 777.');

// Upload the file to your specified path.if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))echo 'Your file upload was successful, view the file a href="' . $upload_path . $filename . '" title="Your File">here/a>';// It worked.elseecho 'There was an error during the file upload. Please try again.'; // It failed :(.

?>[/CODE]

i get this error

PHP Warning: Unknown: open_basedir restriction in effect. File(C:\Windows\TEMP\) is not within the allowedpath(s): (c:\inetpub\) in Unknown on line 0

Page 21: Using Fastcgi to Host Php Applications on Iis 7

PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

strange as in my php.ini file this is set..

open_basedir="c:\inetpub\"

why do i get this error and why cant i perform uploads?

i am running iis 7 php 5.2 (as per this tutorial)46. Submitted on Feb 23 2009 by

[email protected] any tips on dealing with http 500 errors??47. Submitted on Feb 24 2009 by

[email protected] these instructions don't work with iis7 and php / mysql / phypmyadmin48. Submitted on Mar 01 2009 by

kneekoo That's described in the Security recommendation area, captaingeek:

fastcgi.logging=0

Although it's weird to block error reporting, I haven't checked ISS7 just yet so I don't know if this is normal or it shouldbe fixed by an update. I might check it out soon and see it for myself. Good luck!

49. Submitted on Mar 10 2009 byscubak1w1 Hey Ant,

We are having exactly the same problem as you - that is, the PHP only works for one of the sites in II7...

You mentioned that you "just needed to refresh IIS"...

Can you better define "refresh"?

It works like a charm on the one (the first) site, but not the other two I have now set up...

I tried restarting all the relevant services, a server reboot, etc, etc... still the same issue... (although I am getting a404 rather than a 503...)

Thanks in advance - as you say in your original post, "Any ideas please? I have run out!!!!", although I added a fewmore explainaton points! smile>

Regards,GREG...

50. Submitted on Mar 10 2009 byscubak1w1 *** PHP always calls the file in the 'wwwroot' folder even from other sites *** OK, I had some luck... justsome! smile> *** Here is where we are at NOW... *** If you go to a PHP page on ANY of the sites with, say, thename 'test.php' (with a matching 'test.asp' on every site root) the PHP page that is displayed is the 'test.php' site onthe FIRST site created, not the 'test.php' in the directory for that site!!?? (note that the directory for the FIRST site is'wwwroot' and the other sites have different names.) *** ASP is working as you would expect - and so I set thehandler mapping for 'PHP via Fast CGI' to have the same Path Type as 'ASP', namely 'File.' *** I am thinking that'PHP via Fast CGI' is somehow erroneously defaulting to the always 'calling' the PHP of the same name in'wwwroot'?? *** Any advice or suggestions would be GREATLY appreciated! *** Cheers" GREG...

51. Submitted on Mar 17 2009 [email protected] missing a stept - after step 4 before - testing php -info you'll need to reboot.

52. Submitted on Mar 19 2009 bymithrakaran hai everybody, here i installed all those things based on instruction but i didnt get the php information inbrowser. and also i cant create files in wwwroot itself.. any alternatives...pls give some suggestions...

53. Submitted on Mar 23 2009 byscubak1w1 RE: *** PHP always calls the file in the 'wwwroot' folder even from other sites ***

Found the issue! Hindsight is a wonderful thing of course, but still "d'oh!!"

I was using a php.ini file, a little adjusted, from the test server on IIS5.1 on an XP box, to help ensure I kept mysettings as I had tweaked them for all my extensions and so forth...

Page 22: Using Fastcgi to Host Php Applications on Iis 7

In this 'carry over' php.ini file I had

doc_root = "C:\inetpub\wwwroot"

I just REMed this out, rebooted the server, viola!

Phew! I thought I was going nuts - and have learnt to check my .ini file in *much* great detail! grin>

Onward...

Cheers!54. Submitted on May 26 2009 by

slhungry none of the pecl extensions seem to load when running phpinfo(). i'm running win2008 x64. could it bebecause the dlls are x86? one example is the php_fileinfo.dll doesn't load. has anyone been able to get this working?

thx55. Submitted on May 26 2009 by

slhungry i just tried loading some pecl dll on win2008 x86 and it still doesn't show loaded in phpinfo(). anyone haveany luck? i'm using php-5.2.9-2-nts-Win32 and pecl-5.2.6-Win32

thanks!56. Submitted on May 26 2009 by

slhungry i got it working, i just needed the nonthread safe pecl files.57. Submitted on Jun 05 2009 by

blazingbiz Hi thanks for the write up, I have a few comments:

1. The link for details on the App Pool isolation didn't work but I found this article online:http://www.adopenstatic.com/cs/blogs/ken/archive/2008/01/29/15759.aspx This article seems to suggest a betterway to isolate the App Pools and content of the sites, for those who read this article and can answer this question:"even though the web sites are given read permissions for their respective app pool identities, isn't the fact that theapp pools still run in the Network Service context still allow them to read the files of the other sites?" - please do.

2. I read some comments in the IIS 7 PHP blog about the new improved team work between the PHP team andMicrosoft and they recommend using the windows PHP msi installer that can be used with the Web PI tool and I didthat, what should I be aware of since this is different from the usual way of doing a manual install with the PHP zipfiles, I had it set up that way before but would like to use the Web PI tool going forward.

3. I like the individual php.ini set up outlined towards the end of this article and am setting this up right now on myserver, my concern though is that the php.ini file would be in a web accessible folder online on a live production site,following the examples given here. How would I mitigate this without causing read permission problems on thephp.ini file?

Thanks58. Submitted on Jun 05 2009 by

blazingbiz Also when I set up the individual handler mappings for each site to get the individual site php.ini file I usethe IIS Manager and get an error about entering the exe path and -d arguement within double quotation marks, whenI do it proceeds without error and asks me to if I want to create a FastCGI application for this local mapping, which Ianswered Yes in the dialouge box.

Then I check in the Fast CGI section of the server node and see the new Fast CGI application created, I hadpreveiously created Fast CGI applications for each of the sites I'm doing this for, the difference between them andthe ones created for me via the local site Handler Mapping process is that the new ones have double quotationmarks. I also checked the newly created web.config in my local site and see the Handler Mapping as outlined in theabove article, the php-cgi.exe with the -d arguement. So based on this I have two questions:

1. Can I just manually create the web.config files for each of these local websites and have them point the FastCGIApplications I've already set up without any regard to the double quotation marks or not?

2. The Error Message stated that using a file path with spaces in it, such as the default Program Files/PHP file pathused when installing the php with the windows installer that the Web PI tool uses, would cause an error withoutdouble quotation marks being used. But I set this up with file path under Program Files without quotation marks andit worked fine, why is that?

Page 23: Using Fastcgi to Host Php Applications on Iis 7

59. Submitted on Jun 06 2009 byBetchers I'm trying to get this to work on Vista, I've been following a couple of different blogs video tutorial and nowthis tutorial as far as I can tell I've had it set up correctly all along the original post I was following washttp://tutorials.whichdomainhost.co.uk/iis/installing-an-configuring-php-on-iis-7-using-fastcgi I have just cut andpasted in the php.ini changes. Slack I know but I'm new to this. I keep getting 404 errors when trying to run thephpinfo file! Arrgh

60. Submitted on Jun 06 2009 byBetchers Sorted it, at last! The syntax and settings were all fine I just needed to download SP2, it turns out I wasrunning an older version of Vista.

Cheres

Betchers61. Submitted on Jun 26 2009 by

dvd212 Hello

Im getting this error:

HTTP Error 500.0 - Internal Server ErrorC:\php5\php-cgi.exe - The FastCGI process exited unexpectedly

62. Submitted on Jul 09 2009 bymformigo Hello.

I'm a web developer specialized in php & mysql, on a Windows enviroment with IIS.I used to have XP Pro with IIS 5, with php and mysql working fine.Some time ago i bought a new laptop which came with Vista Home Premium, so i decided to give it a try. I folloedthis tutorial in order to install IIS 7, php 5.2.x and mysql. Everything went fine, aparently, an the ?php phpinfo(); ?>worked ok.

My actual configuration is as follows:Windows Vista Home Premium SP1IIS 7.0 SP1php 5.2.10 ntsmysql 5.1.31

My problem is that IIS began sudently showing a HTTP 500 Internel Server Error.It states as most likely causes the website under maintainance or a programming error.Well, under maintainance naturally doesn't apply, for obvious reasons.And regarding the programming error, i find that very unlikely, because of the following:1st. it doesn't happen when i code something wrong on purpose.2nd. last time this HTTP 500 error occurred was about 2 days ago when i first turned on the laptop to work stillhaving done nothing that day. the curious thing is that the day before, working on that same project, it was renderingthe site just fine just before i shut down the computer.

Sometimes i can get the site to work fine again, but generally i just create a new blank file, copy the content of theoriginal to the new, delete the original and rename the new to the original's name.In other words, I don't change absolutelly nothing in the coding, just replace the file itself and that's it. The problem isthat the site requires many separate files and going around doing this everytime the IIS "gets crazy" like this, it's notvery helpful for the work process.

I've been trying to resolve this situation, but with no sucess until now.I already cleaned and reconfigured php on IIS all over again, just in case.I searched the web for any reference to this problem, but didn't find any other HTTP 500 errors with this simptons.

Sincerelly, i'm running out of ideas....i already thought if this could be some kind of timeout which is preventing the page script from being correctlyprocessed.I also found some topics regarding a certain instability on the use of FastCGI on IIS 7, but again none quitedescribed the simptons i ran across.

An option i'm considering is replacing the fastcgi configuration for the isapi.It may not be so fast, but perhaps can be more stable when dealing with this problem.Another option is to completely replace IIS with Apache (the problema is i tend to prefer IIS so i would rather not

Page 24: Using Fastcgi to Host Php Applications on Iis 7

have to come to this).In last case scenario, I can downgrade and return to XP Pro with IIS 5.. but once again i would prefer to solve thisand be able to continue with Vista and IIS 7.

Any help will be deeply apreciated.Thank you all in advance for your time.

Best regards,Michael

63. Submitted on Jul 09 2009 byIshaiH I just installed PHP and the FastCGI update with the web platform installer (http://www.microsoft.com/web/).It made all the basic configurations (I still didn't check the best practices settings but PHP is working without havingto do anything extra)this platform installer tool is great