Anda di halaman 1dari 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:

Windows Vista SP1


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

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 the update 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 FastCGI settings. 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 provides significant performance gains over the standard build by not doing any thread-safety checks, which are not necessary, since FastCGI 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 what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHP CGI 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.dll extension=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 the current 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 specific requests to the PHP application framework via FastCGI protocol.

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:

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 contains the following code: <?php phpinfo(); ?>

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

NOTE: If you do not see "FastCgiModule" in the "Modules:" drop-down list then it means that the module is not registered or not 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}\phpcgi.exe'] After that, create the handler mapping:

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\{php_folder}\phpcgi.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 security isolation 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 FastCGI process recycling behavior is controlled by the configuration property instanceMaxRequests. This property specifies how many requests the FastCGI process will process before recycling. PHP also has a similar process recycling functionality that is controlled by an environment variable PHP_FCGI_MAX_REQUESTS. By setting instanceMaxRequests to be smaller or equal 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 then select FastCGI settings at the server level:

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

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

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:

C:\>%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='c:\{php_folder}\phpcgi.exe'].instanceMaxRequests:10000 C:\>%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='C:\{php_folder}\phpcgi.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 to be hosted on the same server then different PHP versions must be enabled and running side-by-side. The IIS 7.0 FastCGI handler fully supports running multiple versions of PHP on the same web server. For example, lets assume that on your web server you plan to support PHP 4.4.8, PHP 5.2.1 and PHP 5.2.5 non-thread safe. 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\phpcgi.exe'] Now, if you have 3 web sites (site1, site2, site3), where each site needs to use a different PHP version, you can define handler 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,reso urceType=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\phpcgi.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\phpcgi.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 locate and open the php.ini file and edit the configuration settings as described below: Setting allow_url_fopen=Off allow_url_include=Off register_globals=Off open_basedir="c:\inetpub\" safe_mode=Off safe_mode_gid=Off max_execution_time=30 max_input_time=60 memory_limit=16M upload_max_filesize=2M Description Disable remote URLs for file handling functions, which may cause code injection vulnerabilities. Disable register_globals. Restrict where PHP processes can read and write on a file system. Disable safe mode Limit script execution time Limit memory usage and file sizes

post_max_size=8M max_input_nesting_levels=64 display_errors=Off log_errors=On Configure error messages and logging error_log="C:\path\of\your\choice" fastcgi.logging=0 expose_php=Off IIS FastCGI module will fail the request when PHP sends any data on stderr by using FastCGI protocol. Disabling FastCGI logging will prevent PHP from sending error information over stderr, and generating 500 response codes for the client. 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 was discovered and validated by Radney Jasmin with hosting provider GoDaddy.com who now offers PHP hosting on Windows Server 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 a dedicated FastCGI process pool with each web site. A FastCGI process pool is uniquely identified by the combination of fullPath and arguments attributes. So, if it is necessary to create several FastCGI process pools for the same process executable, 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 switch can 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, the FastCGI 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 enforces that the PHP executable for each process pool can perform file operations only within the root folder of the corresponding web 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\phpcgi.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\phpcgi.exe|-d open_basedir=C:\Websites\Website2" resourceType="Unspecified" requireAccess="Script" /> </handlers> </system.webServer>

Specifying php.ini location


When the PHP process starts it determines the location of the configuration php.ini file by using various settings. The PHP documentation provides detailed description of the PHP start up process. Note that one of the places where PHP process searches for php.ini location is the PHPRC environment variable. If PHP process finds a php.ini file in the path specified in this environment variable then it will use it, otherwise it will revert to default location of php.ini. This environment variable can be 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 and C:\WebSites\website2 then the php-cgi.exe process pools in the <fastCgi> section of applicationHost.config can be configured 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 version of php.ini located in C:\WebSites\website2. This configuration also ensures that if there is no php.ini found in location specified by PHPRC environment variable then PHP will fall back to using the default php.ini file located in the same folder where 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 and search 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 WordPress o MediaWiki o b2Evolution o Mambo o 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

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 by radirk Hello, setup was easy enough and I get the phpinfo.php page displayed just fine. However, upon running C:\>%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! Dirk 2. 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 is denied". 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 the administrator group. I have noticed that this needs to be done on other things as well within Vista and 2008. Hope this helps, Aaron 7. 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 by Hybrid SyntaX hi thanks 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 dynamic library '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 x64 is that usual or i did something wrong ?

9. Submitted on Jun 17 2008 by scotteredu 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\) is not 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 by ruslany The open_basedir is a security protection measure which is useful when the PHP scripts that you deploy on your server are not trusted. For example, this is important to use in shared hosting scenarios. If you know what your script does then you may turn off this setting. Or, alternatively you can configure the PHP session.save_path setting to use file path that is within the scope of the open_basedir restriction. 11. Submitted on Jul 02 2008 by ericandrews This is a well written article, thank you. I am running Vista Ultimate with SP 1. When following these instruction I do not have the option to choose FastCgiModule. I followed these instructions, have CGI chose as an option 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 by ruslany When you enable CGI option, that will also install FastCGI module. You can check if the module is installed by going to IIS manager -> server node -> Modules. 13. Submitted on Jul 13 2008 by patrickneal3 I have followed these directions to a t, and i get nuthing no info page no feedback from command prompt, 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... Thanks ntgt13 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 by ali.engin Thanks, I've installed my php following these instructions and it worked perfectly except that I can't run my pages like ? phpinfo(); ?> I must write it that way ?php phpinfo(); ?> 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.

16.

17.

18. 19.

20.

21.

22.

Can anybody help about that? Also I don't remember that kind of problem in IIS6. May it be because of my php.ini configuration? Submitted on Aug 09 2008 by ali.engin Can I edit my first message? It was my mistake, there was an option in php.ini named short_open_tag and it should be on to use the syntax that I mentioned. Submitted on Aug 18 2008 by jawmusic I have the same problem as Eric. I installed Vista SP1, and enabled CGI but there is no mention of a FastCGI module in the modules listing. When I try to configure the handler I get an error saying that the FastCGI Module does not exist. Suggestions? Submitted on Aug 20 2008 by ruslany Can you check if the following file exists on the file system: %WINDIR%\system32\inetsrv\iisfcg.dll? Submitted on Aug 21 2008 by jawmusic It's not there. I take it it should be? Any recommendations to solve this? I've tried to install FastCGI separately, but it does not recognize a valid installation of Windows (I forget the exact error, but I assume it's because the installer is looking for something other than Vista since it's part of SP1). Submitted on Aug 21 2008 by jawmusic It's not there. I take it it should be? Any recommendations to solve this? I've tried to install FastCGI separately, but it does not recognize a valid installation of Windows (I forget the exact error, but I assume it's because the installer is looking for something other than Vista since it's part of SP1). Thanks for your help. Submitted on Aug 29 2008 by chris davies To be honest,I've tried every tutorial I can find on how to install php5 and configure it with IIS7 to no avail. 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 I attempted to install PHP and now its gone all pear (excuse the pun) shaped. Any advice gratefully recieved. Submitted on Sep 09 2008 by doc-cafein Hi everyone, I've a Vista32 ultimate SP1 with all the IIS sevices and modules installed including CGI. I've also installed the last PHP 5.2.6. However, like jawmusic, I don't have any FastCGI module installed and can't add the 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 available with 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 Gateway L'application CGI spcifie n'a pas renvoy le jeu complet d'en-ttes HTTP. Les en-ttes effectivement retourns sont "PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_oci8.dll' - Le module spcifi 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 spcifi 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 spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_pgsql.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_sqlite_external.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pgsql.dll' - Le module spcifi 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 spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_sybase_ct.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_ibm_db2.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_ifx.dll' - Le module spcifi 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 spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_maxdb.dll' - Le module spcifi 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 spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_netools.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_oracle.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_ibm.dll' - Le module spcifi est introuvable. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_informix.dll' - Le module spcifi est introuvable. in Unknown on line 0 Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none)

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 by nakedintherain 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-install it. 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 download the WMV file...everything is explained for you. good luck. 24. Submitted on Sep 10 2008 by nakedintherain 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 by msanda_77 One thing the article fails to point out, and will help with people trying to use oracle is that if you are running 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. presently http://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 are running 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. presently http://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 to download 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 Dave 28. 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 simply copying 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 the command to succeed. BUT: 2) If you look closely, the single-quote character used to delimit PHP_FCGI_MAX_REQUESTS is an actual single close quote () and not a keyboard apostrophe (') as needed by appcmd. The command will succeed but appcmd incorrectly parses the command line. If your console window uses the default system font, they look exactly the same. The snippet below is the result of the issue: C:\>%windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgi system.webServer>

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\phpcgi.exe'].environmentVariables.[name='10000'] %windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /+[fullPath='c:\php\phpcgi.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 to 10000 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 correct appcmd syntax. 30. Submitted on Oct 15 2008 by John_Scanlon Thanks to all you gurus for never answering the question about not finding the fastcgi module on Vista SP1. Though thank you ruslany, without your almost accurate question about a iisfcg.dll file (it should be issfcgi.dll), I never would have worked this out. What the answer to the missing Fast CGI module seems to be (and I'm a novice, but I can display the phpinfo in IE7, and my machine hasn't crashed), is that if you don't have a FastCgiModule available in the "Handler Mappings" dialogue, you need to 1) go into "Modules" dialogue at the same server level, 2) Choose the "Configure Native Modules" option on the right pane, 3) Choose "Register" on the next window, 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 windows and system directory names being different than mine). Finish configuring this native module, and then the rest of the instructions in this otherwise well written article should work. 31. Submitted on Oct 16 2008 by ruslany Hi John_Scanlon, sorry for not getting back to you on your question. I am glad you have worked it out. We are revising this article and I will make sure to include the steps you described about registering FastCGI module. 32. Submitted on Oct 16 2008 by ruslany 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 by subcientifico If you want to use XDebug or DBG, then you need the thread safe version of PHP. 34. Submitted on Nov 14 2008 by joyann 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 it off, reboot and then turn it back on. After a two hour hunt, I found this.... "Microsoft Windows Service Pack 1 does not automatically enable the FastCGI module for already installed IIS. To enable it, turn the CGI feature off, and then turn it on again." http://www.witsuite.com/support/knowledge-base/manual-installation/install-iis-fastcgi.php#enable-iis-cgi-feature

35. Submitted on Dec 16 2008 by david.s Just a note for others that may encounter this problem. IIS7 is apparently not compatible with running PHP apps like WordPress or MediaWiki in wwwroot due to a problem with retrieving path information using functions like realpath(). They run fine in subdirectories. 36. Submitted on Dec 18 2008 by coreygo Also this guide suggests using the ZIP package of PHP to install. Because of this when I first set up FastCGI 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 registry entry should be added for PHP: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath = C:\PHP. After I created this, I got the Hello World and PHPInfo pages to run correctly. 37. Submitted on Jan 01 2009 by festuc 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 Thanks 38. 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.ini path is C:\php\php.ini. This is where the php configuration is loaded from by default when using fastcgi. You can change this path by using the registry entry, but much less invasive way of changing it is to define an environment variable 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 by Lonestarjack I am using Vista SP1 and PHP5.2.8 I 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 getting 500.21 for a "bad module IsapiModule in its module list". Do I need ASP.NET? 41. Submitted on Jan 31 2009 by AntG Hi, First, thanks for a really helpful and clear article. With your guidance I have fully installed PHP on IIS and I had a working installation with a single php.ini. However I want a per-site configuration. I have three sites on my Vista Ultimate/IIS 7.0 machine each with their own root and pool. After some trial and error I think I have the applicationHost.config file in good shape - with the code that you give for "website1", "website2" etc modified and inside 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 by AntG Ha! had it right - just needed to refresh IIS. Thanks again for your clarity. 43. Submitted on Feb 13 2009 by menkes Using Vista Ultimate 32-bit SP1, IIS 7, PHP 5.2.8 Used zipped, thread-safe version of PHP Modified php.ini as above Added c:\php to PATH environment variable Added 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 IUSR Added php Handler as above (verified 10+ times that all spelled and entered correctly) pointing to c:\php\php-cgi.exe Run phpinfo() from command line and all is good BUT....

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 a handler. If the file should be downloaded, add a MIME map." Module: StaticGileModule Notification: ExecuteRequestHandler Handler: StaticFile Error Code: 0x80070032 Requested URL: http://localhost:80/php_info.php Physical Path: C:\inetpub\wwwroot\php_info.php Logon Method: Anonymous Logon 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 by changing 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. else echo '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 allowed path(s): (c:\inetpub\) in Unknown on line 0

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 captaingeek@gmail.com any tips on dealing with http 500 errors?? 47. Submitted on Feb 24 2009 by captaingeek@gmail.com these instructions don't work with iis7 and php / mysql / phypmyadmin 48. 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 should be fixed by an update. I might check it out soon and see it for myself. Good luck! 49. Submitted on Mar 10 2009 by scubak1w1 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 a 404 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 few more explainaton points! smile> Regards, GREG... Submitted on Mar 10 2009 by scubak1w1 *** PHP always calls the file in the 'wwwroot' folder even from other sites *** OK, I had some luck... just some! smile> *** Here is where we are at NOW... *** If you go to a PHP page on ANY of the sites with, say, the name 'test.php' (with a matching 'test.asp' on every site root) the PHP page that is displayed is the 'test.php' site on the 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 the handler 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... Submitted on Mar 17 2009 by captaingeek@gmail.com missing a stept - after step 4 before - testing php -info you'll need to reboot. Submitted on Mar 19 2009 by mithrakaran hai everybody, here i installed all those things based on instruction but i didnt get the php information in browser. and also i cant create files in wwwroot itself.. any alternatives...pls give some suggestions... Submitted on Mar 23 2009 by scubak1w1 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 my settings as I had tweaked them for all my extensions and so forth...

50.

51. 52.

53.

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 be because the dlls are x86? one example is the php_fileinfo.dll doesn't load. has anyone been able to get this working? thx 55. 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 have any 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 better way 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 the app 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 and Microsoft and they recommend using the windows PHP msi installer that can be used with the Web PI tool and I did that, what should I be aware of since this is different from the usual way of doing a manual install with the PHP zip files, 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 my server, 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 the php.ini file? Thanks 58. 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 use the IIS Manager and get an error about entering the exe path and -d arguement within double quotation marks, when I do it proceeds without error and asks me to if I want to create a FastCGI application for this local mapping, which I answered 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 had preveiously created Fast CGI applications for each of the sites I'm doing this for, the difference between them and the ones created for me via the local site Handler Mapping process is that the new ones have double quotation marks. I also checked the newly created web.config in my local site and see the Handler Mapping as outlined in the above 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 FastCGI Applications 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 path used when installing the php with the windows installer that the Web PI tool uses, would cause an error without double quotation marks being used. But I set this up with file path under Program Files without quotation marks and it worked fine, why is that?

59. Submitted on Jun 06 2009 by Betchers I'm trying to get this to work on Vista, I've been following a couple of different blogs video tutorial and now this tutorial as far as I can tell I've had it set up correctly all along the original post I was following was http://tutorials.whichdomainhost.co.uk/iis/installing-an-configuring-php-on-iis-7-using-fastcgi I have just cut and pasted in the php.ini changes. Slack I know but I'm new to this. I keep getting 404 errors when trying to run the phpinfo file! Arrgh 60. Submitted on Jun 06 2009 by Betchers Sorted it, at last! The syntax and settings were all fine I just needed to download SP2, it turns out I was running an older version of Vista. Cheres Betchers 61. Submitted on Jun 26 2009 by dvd212 Hello Im getting this error: HTTP Error 500.0 - Internal Server Error C:\php5\php-cgi.exe - The FastCGI process exited unexpectedly 62. Submitted on Jul 09 2009 by mformigo 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 folloed this 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 SP1 IIS 7.0 SP1 php 5.2.10 nts mysql 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 still having done nothing that day. the curious thing is that the day before, working on that same project, it was rendering the 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 the original 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 is that the site requires many separate files and going around doing this everytime the IIS "gets crazy" like this, it's not very 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 correctly processed. I also found some topics regarding a certain instability on the use of FastCGI on IIS 7, but again none quite described 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

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 this and 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 by IshaiH 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 having to do anything extra) this platform installer tool is great

Anda mungkin juga menyukai