Windows2003 using the IIS7 Express use FastCgi to run PHP

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

     First, some background, because it is to rent their own VPS management code, some service program files and run their own use, in order to cheap and stable consider hired Windows2003 VPS, a total of only 1G memory, very difficult.

     This block in Web, with a 2003 server, need to run PHP and ASP.NET, the PHP installation IIS6, install Rewrite components, can run WordPress, but the rewrite component has expired, to find the various versions of the installation of online, still no use, always prompt has expired.

     So we had to consider the use of reverse proxy to do with nginx, The dynamic analysis to the IIS6 and Apache, But the overall memory footprint looks a little big, So the disabled Apache, To use nginx PHP-cgi.exe to run WordPress, That seems to promote the access speed, But the PHP process can automatically exit, So he wrote a management php-cgi.exe daemon. Later, Nginx is not normal, A little trouble from time to time, Php-cgi daemon only start a process, Often a problem, If you start a pile of words, Plus the daemon and php-cgi memory, Not as a direct nginx to Apache.

     In short, identified in the windows, want to run PHP, and save memory, really not easy.

     Then considering the IIS7.5 Express the WIN2003 can run on, not only in the form of fastcgi support PHP, also comes with Rewrite components, simply change the web.config rule rules can be.

     So the baidu downloaded IIS7.5 Express, installation, also need to configure the applicationHost.config, first to find the file where, if can be found in "My Documents" in the IIS7Express directory, that it is, or should be in the IIS7 installation directory under the Express.

     1,First Amendment: section defaultDocument, join<add value="index.php" />

<defaultDocument enabled="true">
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
                <add value="index.php" />

     2,Find the fastcgi section.

            <application fullPath="C:\php\php-cgi.exe" monitorChangesTo="php.ini" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
                    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
                    <environmentVariable name="PHPRC" value="C:Program Files (x86)iis expressPHPv5.4" />

   3,Find handlles, join

 <add name="PHP_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="Either" />

    Particular attention to is, this one with the best in the front, also is in the <handlles> the first sentence below, to avoid being other Handle preempted.

    The above configuration, the partial replacement of C:\php\php-cgi.exe into your PHP folder in the php-cgi.exe position.

  4,In the <site> configuration section, directly modify the site information, to add the site or the direct use of appcmd.exe add site.

  5,Find the installation folders such as WordPress, create a web.config file, in the configuration configuration section, add the Gzip compression rules.

   <urlCompression doStaticCompression="true" doDynamicCompression="true" />

 6,Also in web.config, the contents of the web.config file Wordpress rewrite complete the following:

        <rule name="wordpress" patternSyntax="Wildcard">
          <match url="*" />
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          <action type="Rewrite" url="index.php" />
   <urlCompression doStaticCompression="true" doDynamicCompression="true" />

 This completely configured, then find IISExpress.exe in the IIS7 Express directory,, directly click operation, or use the command line to execute the specified load which site. 

iisexpress.exe /site:'The site name 1"
iisexpress.exe /site:'The site name 2"

 Visit, you will find the access speed than the use of Apache in windows is much faster, but less to run a nginx, memory footprint on the whole have a lot less.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Brenda at October 23, 2013 - 9:13 PM