{"id":1018,"date":"2011-12-28T03:52:15","date_gmt":"2011-12-28T03:52:15","guid":{"rendered":"http:\/\/www.webputzer.com\/?p=1018"},"modified":"2013-09-09T17:41:11","modified_gmt":"2013-09-09T17:41:11","slug":"fastcgi","status":"publish","type":"post","link":"http:\/\/www.webputzer.com\/?p=1018","title":{"rendered":"Installing FastCGI PHP on Windows Server 2008"},"content":{"rendered":"<p>The following links contain information which might be helpful in performing this installation &#8211; I&#8217;ve included them here for reference&#8230;&#8230;<\/p>\n<p><a href=\"http:\/\/php.net\/manual\/en\/install.windows.iis7.php\">http:\/\/php.net\/manual\/en\/install.windows.iis7.php<\/a><\/p>\n<p><a href=\"http:\/\/wiki.resourcespace.org\/index.php\/Installing_on_Windows_Server_2008_R2_64-bit\">http:\/\/wiki.resourcespace.org\/index.php\/Installing_on_Windows_Server_2008_R2_64-bit<\/a><\/p>\n<p>From the web:<br \/>\nAccording to IIS.net\u2026<\/p>\n<p>\u2026the FastCGI component enables popular application frameworks like PHP be hosted on the IIS web server in a high-performance and reliable way.<\/p>\n<p>Mike Volodarsky, a program manager on Microsoft\u2019s IIS team, has expressed the following on his blog about why using PHP with FastCGI is the prefered method over ISAPI:<\/p>\n<p>The main reason why ISAPI is not an adequate solution is the lack of thread safety in many popular PHP extensions. The PHP core itself is thread safe, and so are some of the extensions, so its possible that some applications will work correctly in the ISAPI environment. However, many production environments do experience instability with the ISAPI.<br \/>\nSo that being said, let\u2019s take a look at how to install configure the FastCGI extension to work with PHP 5.<\/p>\n<p><span style=\"font-family: arial; font-size: 20px;\">Installing FastCGI PHP on Windows Server 2008<\/span><\/p>\n<p>As opposed to previous versions of Windows Server, the FastCGi module is already bundled with Windows Server 2008 so you don\u2019t have to install it.<\/p>\n<p>First of all, let\u2019s make sure that the CGI role service is installed. Click on <em>Start =&gt; Programs =&gt; Administrative Tools =&gt; Server Manager<\/em>. Expand <strong>Roles<\/strong>, right-click on <strong>Web Server (IIS)<\/strong> and select <em>Add Role Services<\/em>. Make sure that <strong>CGI<\/strong> is checked and if not proceed with its installation.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/iis7-cgi-role-service.jpg\" alt=\"iis7-cgi-role-service.jpg\" \/><\/p>\n<p>Next head over to <a href=\"http:\/\/www.php.net\/downloads.php\" target=\"_blank\">PHP.net\u2019 download page<\/a> and download the <strong>PHP Non-thread-safe Win32 binaries<\/strong>. <em>At the time of this writing, the latest version of PHP is 5.2.5. <\/em>Extract the content from the PHP archive into <strong>c:\\php<\/strong>.<\/p>\n<p>Launch the <strong>Internet Information Server Manager<\/strong> by clicking on <em>Start =&gt; Programs =&gt; Administrative Tools =&gt; Internet Information Server Manager<\/em>. Select your server from the left panel and then double-click on the <strong>Handler Mappings<\/strong> icon.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/iis7-handler-mappings1.jpg\" alt=\"iis7-handler-mappings1.jpg\" \/><\/p>\n<p>Click on <strong>Add Module Mapping<\/strong> from the right column:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/iis-add-module-mapping.jpg\" alt=\"iis-add-module-mapping.jpg\" \/><\/p>\n<p>Fill-in the PHP module mapping information as illustrated below and click on <strong>OK<\/strong> when done:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/iis-php-cgi-mapping.jpg\" alt=\"iis-php-cgi-mapping.jpg\" \/><\/p>\n<p>At this point PHP should now be working even though there no <strong>php.ini<\/strong> configuration file yet. To find out if PHP files are parsed correctly, create a new file at the root of website\u2019s folder and name it <strong>phpinfo.php<\/strong>. Insert the following content into the file and save it:<\/p>\n<blockquote><p>&lt;?php phpinfo(); ?&gt;<\/p><\/blockquote>\n<p>Now try pointing your web browser to <em>http:\/\/yourserver.com\/phpinfo.php<\/em>. If everything works properly you should see this page:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/phpinfo.jpg\" alt=\"phpinfo.jpg\" \/><\/p>\n<p><span style=\"font-family: arial; font-size: 22px;\">Configuring PHP<\/span><\/p>\n<p>By default, IIS will look for PHP\u2019s configuration file (php.ini) in <strong>c:\\windows<\/strong>. To change this, launch the registry editor (<em>Start =&gt; Run =&gt; regedit<\/em>) and add a new key named <strong>PHP<\/strong> in <strong>HKEY_LOCAL_MACHINE\\SOFTWARE\\<\/strong>. Under the newly created key, create a new value named IniFilePath and set its value data to <strong>c:\\php<\/strong>.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2011\/12\/php-registry.jpg\" alt=\"php-registry.jpg\" \/><\/p>\n<p>Close the registry editor when you\u2019re done. Using the Windows Explorer, rename <strong>c:\\php\\php.ini-recommended<\/strong> to <strong>c:\\php\\php.ini<\/strong> and open it with your favorite text editor (no word processor). Find the <strong>extension_dir<\/strong> parameter and set its value to <strong>\u201cc:\\php\\ext\u201d<\/strong>. You might also want to uncomment <strong>extension=php_mysqli.dll<\/strong> and \/ or <strong>extension=php_mssql.dll<\/strong> if you plan to use MySQL or MS-SQL.<\/p>\n<p>Once you\u2019re done editing PHP\u2019s configuration file, save it and close your file editor. You will need to restart IIS in order to apply the changes. This can be done through the IIS Manager:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/wp-content\/uploads\/2012\/03\/restart-iis.jpg\" alt=\"restart-iis.jpg\" \/><\/p>\n<p>I\u2019ll try to perform some benchmark test to see how this setup compares to using php5isapi.dll.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following links contain information which might be helpful in performing this installation &#8211; I&#8217;ve included them here for reference&#8230;&#8230; http:\/\/php.net\/manual\/en\/install.windows.iis7.php http:\/\/wiki.resourcespace.org\/index.php\/Installing_on_Windows_Server_2008_R2_64-bit From the web: According to IIS.net\u2026 \u2026the FastCGI component enables popular application frameworks like PHP be hosted on the IIS web server in a high-performance and reliable way. Mike Volodarsky, a program manager [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"h5ap_radio_sources":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1018","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/1018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1018"}],"version-history":[{"count":0,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/1018\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1018"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}