use-php-fcgi.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <!-- Always force latest IE rendering engine or request Chrome Frame -->
  6. <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  8. <!-- Use title if it's in the page YAML frontmatter -->
  9. <title>Run PHP under FastCGI</title>
  10. <link href="/dashboard/stylesheets/normalize.css" rel="stylesheet" type="text/css" /><link href="/dashboard/stylesheets/all.css" rel="stylesheet" type="text/css" />
  11. <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
  12. <script src="/dashboard/javascripts/modernizr.js" type="text/javascript"></script>
  13. <link href="/dashboard/images/favicon.png" rel="icon" type="image/png" />
  14. </head>
  15. <body class="docs docs_use-php-fcgi">
  16. <div id="fb-root"></div>
  17. <script>(function(d, s, id) {
  18. var js, fjs = d.getElementsByTagName(s)[0];
  19. if (d.getElementById(id)) return;
  20. js = d.createElement(s); js.id = id;
  21. js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=277385395761685";
  22. fjs.parentNode.insertBefore(js, fjs);
  23. }(document, 'script', 'facebook-jssdk'));</script>
  24. <div class="contain-to-grid">
  25. <nav class="top-bar" data-topbar>
  26. <ul class="title-area">
  27. <li class="name">
  28. <h1><a href="/dashboard/index.html">Apache Friends</a></h1>
  29. </li>
  30. <li class="toggle-topbar menu-icon">
  31. <a href="#">
  32. <span>Menu</span>
  33. </a>
  34. </li>
  35. </ul>
  36. <section class="top-bar-section">
  37. <!-- Right Nav Section -->
  38. <ul class="right">
  39. <li class=""><a href="/applications.html">Applications</a></li>
  40. <li class=""><a href="/dashboard/faq.html">FAQs</a></li>
  41. <li class="active"><a href="/dashboard/howto.html">HOW-TO Guides</a></li>
  42. <li class=""><a target="_blank" href="/dashboard/phpinfo.php">PHPInfo</a></li>
  43. <li class=""><a href="/phpmyadmin/">phpMyAdmin</a></li>
  44. </ul>
  45. </section>
  46. </nav>
  47. </div>
  48. <div id="wrapper">
  49. <div class="hero">
  50. <div class="row">
  51. <div class="large-12 columns">
  52. <h1>Documentation</h1>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="row">
  57. <div class="large-12 columns">
  58. <ul class="sub-nav">
  59. <li>
  60. <a class="pdf" target="_blank" href="/dashboard/docs/use-php-fcgi.pdf"> Download PDF
  61. <span>use-php-fcgi.pdf</span>
  62. </a> </li>
  63. </ul>
  64. <article class="asciidoctor">
  65. <h1>Run PHP under FastCGI</h1>
  66. <div class="paragraph">
  67. <p>By default, XAMPP runs PHP as an Apache handler. An alternative approach is to run PHP under FastCGI, which can produce better performance in certain scenarios. To do this, follow these steps:</p>
  68. </div>
  69. <div class="olist arabic">
  70. <ol class="arabic">
  71. <li>
  72. <p>Download a binary version of the <em>mod_fcgid</em> Apache module from <a href="http://www.apachelounge.com/download/">the ApacheLounge website</a>. This module is included in the <em>modules-2.4.x-win32-VC11.zip</em> archive.</p>
  73. <div class="admonitionblock note">
  74. <table>
  75. <tr>
  76. <td class="icon">
  77. <i class="fa icon-note" title="Note"></i>
  78. </td>
  79. <td class="content">
  80. XAMPP for Windows only uses 32-bit Apache builds.
  81. </td>
  82. </tr>
  83. </table>
  84. </div>
  85. </li>
  86. <li>
  87. <p>Extract the <em>mod_fcgid.so</em> file from the downloaded archive file and copy it to the <em>apache\modules</em>\ subdirectory of your XAMPP installation directory (usually, <em>C:\xampp</em>).</p>
  88. </li>
  89. <li>
  90. <p>Edit the <em>httpd-xampp.conf</em> file in the <em>apache\conf\extra\</em> subdirectory of your XAMPP installation directory. Within this file, make the following changes:</p>
  91. <div class="olist loweralpha">
  92. <ol class="loweralpha" type="a">
  93. <li>
  94. <p>Search for the line</p>
  95. <div class="literalblock">
  96. <div class="content">
  97. <pre>LoadModule php5_module "/xampp/php/php5apache2_4.dll"</pre>
  98. </div>
  99. </div>
  100. <div class="paragraph">
  101. <p>and modify it to read</p>
  102. </div>
  103. <div class="literalblock">
  104. <div class="content">
  105. <pre>LoadModule fcgid_module modules/mod_fcgid.so</pre>
  106. </div>
  107. </div>
  108. </li>
  109. <li>
  110. <p>Find and delete the following lines:</p>
  111. <div class="literalblock">
  112. <div class="content">
  113. <pre>&lt;FilesMatch "\.php$"&gt;
  114. SetHandler application/x-httpd-php
  115. &lt;/FilesMatch&gt;
  116. &lt;FilesMatch "\.phps$"&gt;
  117. SetHandler application/x-httpd-php-source
  118. &lt;/FilesMatch&gt;</pre>
  119. </div>
  120. </div>
  121. </li>
  122. <li>
  123. <p>Add the following lines:</p>
  124. <div class="literalblock">
  125. <div class="content">
  126. <pre>FcgidInitialEnv PHPRC "c:/xampp/php"
  127. AddHandler fcgid-script .php
  128. FcgidWrapper "c:/xampp/php/php-cgi.exe" .php</pre>
  129. </div>
  130. </div>
  131. <div class="admonitionblock note">
  132. <table>
  133. <tr>
  134. <td class="icon">
  135. <i class="fa icon-note" title="Note"></i>
  136. </td>
  137. <td class="content">
  138. Remember to adjust the file and directory paths above to reflect valid paths on your system.
  139. </td>
  140. </tr>
  141. </table>
  142. </div>
  143. </li>
  144. </ol>
  145. </div>
  146. </li>
  147. <li>
  148. <p>Restart your Apache server through the XAMPP control panel for your changes to take effect.</p>
  149. </li>
  150. </ol>
  151. </div>
  152. <div class="paragraph">
  153. <p>PHP should now be active using FastCGI. To verify this, browse to the URL <a href="http://localhost/xampp/phpinfo.php" class="bare">http://localhost/xampp/phpinfo.php</a>, which displays the output of the <em>phpinfo()</em> command, and check the "Server API" value near the top of the page.</p>
  154. </div>
  155. <div class="imageblock">
  156. <div class="content">
  157. <img src="./images/use-php-fcgi/image1.png" alt="image1">
  158. </div>
  159. </div>
  160. </article>
  161. </div>
  162. </div>
  163. </div>
  164. <footer>
  165. <div class="row">
  166. <div class="large-12 columns">
  167. <div class="row">
  168. <div class="large-8 columns">
  169. <ul class="social">
  170. <li class="twitter"><a href="https://twitter.com/apachefriends">Follow us on Twitter</a></li>
  171. <li class="facebook"><a href="https://www.facebook.com/we.are.xampp">Like us on Facebook</a></li>
  172. <li class="google"><a href="https://plus.google.com/+xampp/posts">Add us to your G+ Circles</a></li>
  173. </ul>
  174. <ul class="inline-list">
  175. <li><a href="https://www.apachefriends.org/blog.html">Blog</a></li>
  176. <li><a href="https://www.apachefriends.org/privacy_policy.html">Privacy Policy</a></li>
  177. <li>
  178. <a target="_blank" href="http://www.fastly.com/"> CDN provided by
  179. <img width="48" data-2x="/dashboard/images/fastly-logo@2x.png" src="/dashboard/images/fastly-logo.png" />
  180. </a> </li>
  181. </ul>
  182. </div>
  183. <div class="large-4 columns">
  184. <p class="text-right">Copyright (c) 2017, Apache Friends</p>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </footer>
  190. <!-- JS Libraries -->
  191. <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  192. <script src="/dashboard/javascripts/all.js" type="text/javascript"></script>
  193. </body>
  194. </html>