{"id":102,"date":"2012-05-24T11:51:19","date_gmt":"2012-05-24T18:51:19","guid":{"rendered":"http:\/\/www.raykain.com\/?p=102"},"modified":"2012-05-24T11:51:19","modified_gmt":"2012-05-24T18:51:19","slug":"php-sql-iis75","status":"publish","type":"post","link":"https:\/\/www.raykain.com\/?p=102","title":{"rendered":"PHP 5.4.3 with Microsoft SQL support on IIS 7.5"},"content":{"rendered":"<p>We have one internal web server at work that was running Windows 2003 server and a very old version oh PHP. \u00a0So it was time to upgrade this box to 2008 R2 and the latest version of PHP. \u00a0I thought that this was going to be a pretty easy migration and should be done in a couple of days and we could power off the old box. \u00a0Not so much. \u00a0PHP has changed since the last time I installed it. \u00a0Microsoft wants you to use it&#8217;s PHP drivers instead of you using the built in MSSQL commands. Since I couldn&#8217;t find anything in on place I am now going to post what I got to work.<\/p>\n<p><strong>PreReqs<\/strong><\/p>\n<p>1. \u00a0Download the latest version of PHP (5.4.3 at the time of writing this) <a title=\"PHP Windows Download\" href=\"http:\/\/windows.php.net\/download\" target=\"_blank\">Download Link<\/a><\/p>\n<p>2. \u00a0Download the latest version of PHP MSSQL Drivers (3.0.1 at the time of writing this) <a title=\"PHP MS SQL Drivers\" href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=20098\" target=\"_blank\">Download Link<\/a><\/p>\n<p>3. \u00a0Download the latest version of PHP Manager for IIS (1.2 at the time of writing this) <a title=\"PHP Manager for IIS\" href=\"http:\/\/phpmanager.codeplex.com\" target=\"_blank\">Download Link<\/a>\u00a0(this is not needed but makes it easier to manage PHP on IIS<\/p>\n<p>4. Download the Microsoft SQL Server 2012 Native Client <a title=\"SQL Server 2012 Native Client\" href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=29065\">Download Link<\/a><\/p>\n<p><strong>Installing IIS<\/strong><\/p>\n<p>1. Launch Server Manager and go to roles<\/p>\n<p>2. Add Roles<\/p>\n<p>3. Add the Web Server (IIS) role<\/p>\n<p>4. Make sure that CGI<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-163\" title=\"Windows 7 XD5-3\" src=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-3-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/a>5. Click install<\/p>\n<p style=\"text-align: left;\">6. Test to make sure that IIS works by going to local host from a web\u00a0browser\u00a0installed on the server<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-165\" title=\"Windows 7 XD5-4\" src=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-4-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/p>\n<p style=\"text-align: left;\"><strong>Installing PHP<\/strong><\/p>\n<p>1. Extract PHP to a directory of your choice. \u00a0For this article I will extract it to C:Program Files (x86)PHP<\/p>\n<p>2. Open Inetmgr<\/p>\n<p>3. Click on the Server in the tree<\/p>\n<p>4. Open up <em>Handler Mappings\u00a0<\/em><\/p>\n<p>5. In the Actions side bar click on Add Module Mapping<\/p>\n<p>6. Fill in your fields like the ones below<\/p>\n<p><a href=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-5-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-166\" title=\"Windows 7 XD5-5-1\" src=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-5-1-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/p>\n<p>7. Before clicking ok click on Request Restrictions and fill in your fields like the ones below<\/p>\n<p><a href=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-6-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-thumbnail wp-image-167\" title=\"Windows 7 XD5-6-1\" src=\"http:\/\/www.raykain.com\/wp\/wp-content\/uploads\/2012\/05\/Windows-7-XD5-6-1-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/p>\n<p>8. Click ok until you get back to the main Internet Information Services Manager Screen (Note: You will get a screen asking you to create a FastCGI application, Click Yes)<\/p>\n<p>9. Close the Internet Information Services Manager Screen.<\/p>\n<p>10. \u00a0Copy the php.ini-production file and rename it to php.ini<\/p>\n<p>a. Make the following changes to php.ini<\/p>\n<p>i.\u00a0fastcgi.impersonate = 1<\/p>\n<p>ii.\u00a0fastcgi.logging = 0<\/p>\n<p>iii.\u00a0cgi.fix_pathinfo=1<\/p>\n<p>iv. cgi.force_redirect = 0<\/p>\n<p>11. Install PHP Manager for IIS<\/p>\n<p>12. Reopen Internet Information Services Manager<\/p>\n<p>13. Go to the Main Server Screen and open PHP Manager<\/p>\n<p>14. \u00a0PHP Manager will tell you about any non optimal configuration settings. Fix any of these that you see fit<\/p>\n<p>15. Test php by clicking on check phpinfo in PHP Manager. \u00a0If successful you should see something that has the php.net logo on it.<\/p>\n<p><strong>Install Microsoft SQL PHP Support<\/strong><\/p>\n<p>1. Install the SQL Server 2012 Native Client<\/p>\n<p>2. Extract the PHP SQL Drivers to your system.<\/p>\n<p>3. Copy the php_sqlsrv_54_nts.dll and php_pdo_sqlsrv_54_nts.dll to C:Program Files (x86)PHPExt<\/p>\n<p>4. Open Up Internet Information Services Manager and go to PHP Manager<\/p>\n<p>5. Click on Enable or disable an Extension<\/p>\n<p>6. Enable both the dll&#8217;s from step 3<\/p>\n<p>7. Restart the server<\/p>\n<p>8. Open up Internet Information Services Manager and go to PHP Manager<\/p>\n<p>9. Click on Check phpinfo() and make sure you have an entry for sqlsrv.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have one internal web server at work that was running Windows 2003 server and a very old version oh PHP. \u00a0So it was time to upgrade this box to 2008 R2 and the latest version of PHP. \u00a0I thought that this was going to be a pretty easy migration and should be done in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p16FBG-1E","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=102"}],"version-history":[{"count":0,"href":"https:\/\/www.raykain.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.raykain.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}