0770.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>How to Install PHP for Windows Internet Information Services (IIS)</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Microsoft,Windows Server,Windows Administration,Web Server,Web Server Administration,Windows,Windows 2022,Server 2022,Microsoft Windows 2022,Microsoft Windows,How To Install PHP For IIS,How To Run PHP On IIS,PHP For IIS On Windows Server,PHP IIS Installation Guide,PHP IIS Install Guide,PHP,PHP Hypertext Preprocessor,Web Development,Web Developer,PHP Development,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="How to Install PHP for Windows Internet Information Services (IIS)">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="07/01/2022 09:58:21 PM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>How to Install PHP for Windows Internet Information Services (IIS)</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is IIS (Internet Information Services)?</h2>
  26. <blockquote><em>Internet Information Services (IIS) for Windows&reg; Server is a flexible, secure and manageable Web server for hosting anything on the Web. From media streaming to web applications, IIS&#39;s scalable and open architecture is ready to handle the most demanding tasks. -<a href="https://www.iis.net/" target="_blank">https://www.iis.net/</a></em></blockquote>
  27. <blockquote> </blockquote>
  28. <h2>What is PHP (PHP Hypertext Preprocessor)?</h2>
  29. <blockquote><em>A popular general-purpose scripting language that is especially suited to web development.<br />
  30. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world. -<a href="https://www.php.net/" target="_blank">https://www.php.net/</a></em></blockquote>
  31. <p> </p>
  32. <p>NOTE: This tutorial assumes IIS is already installed and running on the host. Check out this previous tutorial to find out how to install IIS <a href="https://youtu.be/Gia2dmFrNxs" target="_blank">here</a></p>
  33. <ol>
  34. <li>Log into the Windows server with an account with admin privileges</li>
  35. <li>Download the Non-Thread Safe (NTS) VS16 x64 PHP for Windows .zip <a href="https://windows.php.net/download/" target="_blank">Download</a></li>
  36. <li><label for="cb_li_917989_0">Download Microsoft Visual C++ </label><label for="cb_li_917989_0"><a href="https://aka.ms/vs/16/release/vc_redist.x64.exe" target="_blank">Download</a></label></li>
  37. <li>Install Microsoft Visual C++</li>
  38. <li>Extract the downloaded PHP for Windows .zip file</li>
  39. <li>Rename the extracted folder PHP</li>
  40. <li>Cut the PHP folder to a safe location to run from, such as C:\Program Files</li>
  41. <li>Click the Start button &gt; Search Control &gt; Click Control Panel</li>
  42. <li>Click on System &gt; Advanced system settings</li>
  43. <li>Click the Environment Variables...</li>
  44. <li>Edit the System Path variable</li>
  45. <li>Click the New button</li>
  46. <li>Add the PHP installation directory (ie C:\Program Files\PHP\</li>
  47. <li>Click OK to all open dialog windows</li>
  48. <li>Launch Server Manager from the Start</li>
  49. <li>Click Add roles and features</li>
  50. <li>Click Next on the Before you begin screen</li>
  51. <li>Select Role-based or feature-based installation &gt; Next</li>
  52. <li>Leave Select a server from the server pool selected and select the current Windows server &gt; Next</li>
  53. <li>Expand Web Server (IIS) &gt; Expand Web Server &gt; Expand Application Development &gt; Check the box next to CGI to select it</li>
  54. <li>Click Next</li>
  55. <li>Click Next on the Select features screen</li>
  56. <li>Click Install on the confirmation screen</li>
  57. <li>Leave the installation progress screen open until the install completes</li>
  58. <li>Once the Feature installation completes successfully, click the Close button</li>
  59. <li>Back in Server Manager, click Tools &gt; Internet Information Services (IIS) Manager</li>
  60. <li>Click the server name to select it &gt; Double click Handler Mappings</li>
  61. <li>Click Add Module Mapping at the top right of the dialog</li>
  62. <li>Complete the Add Module Mapping form as follow
  63. <p>Request Path: *.php<br />
  64. Module: FastCGIModule<br />
  65. Executable: C:\Program Files\PHP\php-cgi.exe<br />
  66. Name: PHP</p>
  67. </li>
  68. <li>Click OK</li>
  69. <li>Click Yes to confirm creating the FastCGI application</li>
  70. <li>Click the server name again to select it and return to the main options menu &gt; Double click Default Document</li>
  71. <li>Click Add... at the top right of the dialog</li>
  72. <li>Type index.php &gt; Click OK</li>
  73. <li>Right click on the server name &gt; Stop</li>
  74. <li>Right click on the server name again &gt; Start</li>
  75. <li>Expand the server name &gt; Expand sites &gt; Right click on Default web Site &gt; Select Explore</li>
  76. <li>A File Explorer window will display the wwwroot folder for IIS</li>
  77. <li>Right click in the whitespace &gt; New &gt; Text Document &gt; Name the new file phpinfo.php</li>
  78. <li>Edit phpinfo.php in Notepad and paste the following
  79. <p>&lt;?php<br />
  80. &emsp;phpinfo();<br />
  81. ?&gt;</p>
  82. </li>
  83. <li>Save the changes to phpinfo.php and close Notepad</li>
  84. <li>Open a web browser and navigate to http://DNSorIP/phpinfo.php</li>
  85. </ol> </div>
  86. </div>
  87. </body>
  88. </html>