troubleshoot-apache.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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>Troubleshoot Apache Startup Problems</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_troubleshoot-apache">
  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/troubleshoot-apache.pdf"> Download PDF
  61. <span>troubleshoot-apache.pdf</span>
  62. </a> </li>
  63. </ul>
  64. <article class="asciidoctor">
  65. <aside>
  66. <h3>Contents</h3>
  67. <ol class="sections">
  68. <li><a href="/dashboard/docs/troubleshoot-apache.html#port_80_in_use_by_pid_4">Port 80 in use by PID 4</a></li>
  69. <li><a href="/dashboard/docs/troubleshoot-apache.html#ports_80_and_443_in_use_by_skype">Ports 80 and 443 in use by Skype</a></li>
  70. <li><a href="/dashboard/docs/troubleshoot-apache.html#port_443_in_use_by_vmware">Port 443 in use by VMWare</a></li>
  71. <li><a href="/dashboard/docs/troubleshoot-apache.html#serverroot_must_be_a_valid_directory">ServerRoot Must Be a Valid Directory</a></li>
  72. <li><a href="/dashboard/docs/troubleshoot-apache.html#xampp_cannot_start_on_port_80_windows_10">XAMPP cannot start on port 80 (Windows 10)</a></li>
  73. <li><a href="/dashboard/docs/troubleshoot-apache.html#the_microsoft_edge_browser_cannot_be_used_to_access_local_addresses_using_the_machine_host_name">The Microsoft Edge browser cannot be used to access local addresses using the machine host name.</a></li>
  74. </ol>
  75. </aside>
  76. <h1>Troubleshoot Apache Startup Problems</h1>
  77. <div id="preamble">
  78. <div class="sectionbody">
  79. <div class="paragraph">
  80. <p>Are you having difficulty getting your Apache server started? Here is a list of common problems and their solutions.</p>
  81. </div>
  82. <div class="admonitionblock note">
  83. <table>
  84. <tr>
  85. <td class="icon">
  86. <i class="fa icon-note" title="Note"></i>
  87. </td>
  88. <td class="content">
  89. The information in this document is based on <a href="https://community.apachefriends.org/f/viewtopic.php?f=16&amp;t=69784">this ApacheFriends community forum thread</a>.
  90. </td>
  91. </tr>
  92. </table>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="sect1">
  97. <h2 id="_port_80_in_use_by_pid_4">Port 80 in use by PID 4</h2>
  98. <div class="sectionbody">
  99. <div class="paragraph">
  100. <p>Your XAMPP control panel displays this message:</p>
  101. </div>
  102. <div class="literalblock">
  103. <div class="content">
  104. <pre>XX:XX:XX [Apache] Port 80 in use by "Unable to open process" with PID 4!</pre>
  105. </div>
  106. </div>
  107. <div class="paragraph">
  108. <p>To solve this problem, follow these steps:</p>
  109. </div>
  110. <div class="olist arabic">
  111. <ol class="arabic">
  112. <li>
  113. <p>Right-click the XAMPP control panel icon and select "Run as administrator". Enter administrator credentials (if required) and click "OK" or "Yes" to proceed.</p>
  114. </li>
  115. <li>
  116. <p>Open your Windows command prompt by clicking the "Shell" button in the XAMPP control panel.</p>
  117. </li>
  118. <li>
  119. <p>At the command prompt, enter this command:</p>
  120. <div class="listingblock">
  121. <div class="content">
  122. <pre>netsh http add iplisten ipaddress=::</pre>
  123. </div>
  124. </div>
  125. </li>
  126. <li>
  127. <p>Open the file <em>C:\Windows\system32\drivers\etc\hosts</em> and add the following line to it. Then, save the file.</p>
  128. <div class="literalblock">
  129. <div class="content">
  130. <pre>127.0.0.1 localhost</pre>
  131. </div>
  132. </div>
  133. <div class="imageblock">
  134. <div class="content">
  135. <img src="./images/troubleshoot-apache/image1.png" alt="image1">
  136. </div>
  137. </div>
  138. <div class="paragraph">
  139. <p>This takes care of mapping the <em>localhost</em> domain name to the local machine, which always has the IP address 127.0.0.1.</p>
  140. </div>
  141. </li>
  142. </ol>
  143. </div>
  144. <div class="admonitionblock note">
  145. <table>
  146. <tr>
  147. <td class="icon">
  148. <i class="fa icon-note" title="Note"></i>
  149. </td>
  150. <td class="content">
  151. On some versions of Windows, you will not be able to edit the <em>C:\Windows\system32\drivers\etc\hosts</em> file without administrator privileges. You can edit the file by right-clicking the Notepad icon and selected the "Run as administrator" menu option, then entering administrator credentials (if required) and clicking "OK" or "Yes" to proceed.
  152. </td>
  153. </tr>
  154. </table>
  155. </div>
  156. <div class="admonitionblock tip">
  157. <table>
  158. <tr>
  159. <td class="icon">
  160. <i class="fa icon-tip" title="Tip"></i>
  161. </td>
  162. <td class="content">
  163. If the problem persists even after performing these steps, it could be due to a problem with Microsoft Internet Information Services (IIS), with Windows Work Folders or with third-party services. <a href="https://community.apachefriends.org/f/viewtopic.php?f=16&amp;t=69784">Refer to this page for alternative solutions</a>.
  164. </td>
  165. </tr>
  166. </table>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="sect1">
  171. <h2 id="_ports_80_and_443_in_use_by_skype">Ports 80 and 443 in use by Skype</h2>
  172. <div class="sectionbody">
  173. <div class="paragraph">
  174. <p>Your XAMPP control panel displays these messages:</p>
  175. </div>
  176. <div class="literalblock">
  177. <div class="content">
  178. <pre>XX:XX:XX [Apache] Port 80 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID XXXX!
  179. XX:XX:XX [Apache] Port 443 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID XXXX!</pre>
  180. </div>
  181. </div>
  182. <div class="paragraph">
  183. <p>To solve this problem, follow these steps:</p>
  184. </div>
  185. <div class="olist arabic">
  186. <ol class="arabic">
  187. <li>
  188. <p>Launch Skype.</p>
  189. </li>
  190. <li>
  191. <p>Select the "Tools &#8594; Options &#8594; Advanced &#8594; Connection" menu item and in the resulting screen, disable the use of ports 80 and 443 for incoming Skype connections.</p>
  192. <div class="imageblock">
  193. <div class="content">
  194. <img src="./images/troubleshoot-apache/image2.png" alt="image2">
  195. </div>
  196. </div>
  197. </li>
  198. <li>
  199. <p>Click "Save". Restart Skype for your change to take effect.</p>
  200. </li>
  201. </ol>
  202. </div>
  203. </div>
  204. </div>
  205. <div class="sect1">
  206. <h2 id="_port_443_in_use_by_vmware">Port 443 in use by VMWare</h2>
  207. <div class="sectionbody">
  208. <div class="paragraph">
  209. <p>Your XAMPP control panel displays these messages:</p>
  210. </div>
  211. <div class="literalblock">
  212. <div class="content">
  213. <pre>XX:XX:XX [Apache] Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID XXXX!</pre>
  214. </div>
  215. </div>
  216. <div class="paragraph">
  217. <p>To solve this problem, follow these steps:</p>
  218. </div>
  219. <div class="olist arabic">
  220. <ol class="arabic">
  221. <li>
  222. <p>Launch VMWare Workstation.</p>
  223. </li>
  224. <li>
  225. <p>Use the "Edit &#8594; Preferences &#8594; Shared VMs" menu and in the resulting dialog, enter a new port number for the VMWare Workstation Server.</p>
  226. </li>
  227. <li>
  228. <p>Click "OK" to save your changes. Restart VMWare Workstation for your change to take effect.</p>
  229. </li>
  230. </ol>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="sect1">
  235. <h2 id="_serverroot_must_be_a_valid_directory">ServerRoot Must Be a Valid Directory</h2>
  236. <div class="sectionbody">
  237. <div class="paragraph">
  238. <p>Apache startup includes an error message like the one below:</p>
  239. </div>
  240. <div class="literalblock">
  241. <div class="content">
  242. <pre>httpd.exe: Syntax error on line XX of X:/xampp/apache/conf/httpd.conf: ServerRoot must be a valid directory</pre>
  243. </div>
  244. </div>
  245. <div class="paragraph">
  246. <p>This is a common issue for XAMPP installations on portable devices. It occurs if the Apache configuration file points to a directory that no longer exists (for example, due to a drive letter change when a portable device is removed and reinserted). To solve this problem, follow these steps:</p>
  247. </div>
  248. <div class="olist arabic">
  249. <ol class="arabic">
  250. <li>
  251. <p>If the Apache service is registered (indicated by a green check mark next to its name in the XAMPP control panel), unregister it by clicking the check mark and answering "Yes" in the resulting dialog box.</p>
  252. <div class="imageblock">
  253. <div class="content">
  254. <img src="./images/troubleshoot-apache/image3.png" alt="image3">
  255. </div>
  256. </div>
  257. </li>
  258. <li>
  259. <p>Edit the <em>setup_xampp.bat</em> file in your XAMPP installation directory (usually, <em>C:\xampp</em>). Within the file, find this line:</p>
  260. <div class="literalblock">
  261. <div class="content">
  262. <pre>%PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP%</pre>
  263. </div>
  264. </div>
  265. </li>
  266. <li>
  267. <p>Edit the line to include the special directive "usb" at the end, so that it looks like this.</p>
  268. <div class="literalblock">
  269. <div class="content">
  270. <pre>%PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP% usb</pre>
  271. </div>
  272. </div>
  273. </li>
  274. <li>
  275. <p>Save your changes. The, execute the file by double-clicking it in the Windows Explorer or executing it at the command prompt. This will fix any and all wrong base paths.</p>
  276. </li>
  277. </ol>
  278. </div>
  279. </div>
  280. </div>
  281. <div class="sect1">
  282. <h2 id="_xampp_cannot_start_on_port_80_windows_10">XAMPP cannot start on port 80 (Windows 10)</h2>
  283. <div class="sectionbody">
  284. <div class="paragraph">
  285. <p>By default, Windows 10 starts Microsoft IIS on port 80, which is the same default port used by Apache in XAMPP. As a result, Apache cannot bind to port 80.</p>
  286. </div>
  287. <div class="paragraph">
  288. <p>To check whether port 80 is in use, open a command prompt and run these commands:</p>
  289. </div>
  290. <div class="literalblock">
  291. <div class="content">
  292. <pre>netstat -o -n -a | findstr 0.0.0.0:80
  293. netstat -o -n -a | findstr 127.0.0.1:80</pre>
  294. </div>
  295. </div>
  296. <div class="imageblock">
  297. <div class="content">
  298. <img src="./images/troubleshoot-apache/image4.png" alt="image4">
  299. </div>
  300. </div>
  301. <div class="paragraph">
  302. <p>To disable IIS from running on port 80, follow these steps:</p>
  303. </div>
  304. <div class="olist arabic">
  305. <ol class="arabic">
  306. <li>
  307. <p>Open the Services panel in Computer Management.</p>
  308. </li>
  309. <li>
  310. <p>Search for the "World Wide Web Publishing Service" and select it.</p>
  311. </li>
  312. <li>
  313. <p>Click the link to "Stop the service".</p>
  314. <div class="imageblock">
  315. <div class="content">
  316. <img src="./images/troubleshoot-apache/image5.png" alt="image5">
  317. </div>
  318. </div>
  319. </li>
  320. <li>
  321. <p>Double-click the service name.</p>
  322. </li>
  323. <li>
  324. <p>In the "Startup type" field, change the startup type to "Disabled".</p>
  325. <div class="imageblock">
  326. <div class="content">
  327. <img src="./images/troubleshoot-apache/image6.png" alt="image6">
  328. </div>
  329. </div>
  330. </li>
  331. <li>
  332. <p>Click "OK" to save your changes.</p>
  333. </li>
  334. </ol>
  335. </div>
  336. <div class="paragraph">
  337. <p>You should now be able to start Apache in XAMPP on port 80.</p>
  338. </div>
  339. </div>
  340. </div>
  341. <div class="sect1">
  342. <h2 id="_the_microsoft_edge_browser_cannot_be_used_to_access_local_addresses_using_the_machine_host_name">The Microsoft Edge browser cannot be used to access local addresses using the machine host name.</h2>
  343. <div class="sectionbody">
  344. <div class="paragraph">
  345. <p>If your local machine has the host name 'myhost', you will not be able to access URLs such as <em><a href="http://myhost" class="bare">http://myhost</a></em> in Microsoft Edge. To resolve this, you should instead use the addresses <em><a href="http://127.0.0.1" class="bare">http://127.0.0.1</a></em> or <em><a href="http://localhost" class="bare">http://localhost</a></em>.</p>
  346. </div>
  347. <div class="imageblock">
  348. <div class="content">
  349. <img src="./images/troubleshoot-apache/image7.png" alt="image7">
  350. </div>
  351. </div>
  352. <div class="imageblock">
  353. <div class="content">
  354. <img src="./images/troubleshoot-apache/image8.png" alt="image8">
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. </article>
  360. </div>
  361. </div>
  362. </div>
  363. <footer>
  364. <div class="row">
  365. <div class="large-12 columns">
  366. <div class="row">
  367. <div class="large-8 columns">
  368. <ul class="social">
  369. <li class="twitter"><a href="https://twitter.com/apachefriends">Follow us on Twitter</a></li>
  370. <li class="facebook"><a href="https://www.facebook.com/we.are.xampp">Like us on Facebook</a></li>
  371. <li class="google"><a href="https://plus.google.com/+xampp/posts">Add us to your G+ Circles</a></li>
  372. </ul>
  373. <ul class="inline-list">
  374. <li><a href="https://www.apachefriends.org/blog.html">Blog</a></li>
  375. <li><a href="https://www.apachefriends.org/privacy_policy.html">Privacy Policy</a></li>
  376. <li>
  377. <a target="_blank" href="http://www.fastly.com/"> CDN provided by
  378. <img width="48" data-2x="/dashboard/images/fastly-logo@2x.png" src="/dashboard/images/fastly-logo.png" />
  379. </a> </li>
  380. </ul>
  381. </div>
  382. <div class="large-4 columns">
  383. <p class="text-right">Copyright (c) 2017, Apache Friends</p>
  384. </div>
  385. </div>
  386. </div>
  387. </div>
  388. </footer>
  389. <!-- JS Libraries -->
  390. <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  391. <script src="/dashboard/javascripts/all.js" type="text/javascript"></script>
  392. </body>
  393. </html>