XAMPP錯誤: Apache shutdown unexpectedly解決辦法 & 更改Apache端口號后如何打開localhost的解決辦法 by yojiaku


---恢復內容開始---

今天,在啟動XAMPP中Apache時遇到了這樣的問題:

14:42:24  [Apache]  Error: Apache shutdown unexpectedly.
14:42:24  [Apache]  This may be due to a blocked port, missing dependencies,
14:42:24  [Apache]  improper privileges, a crash, or a shutdown by another method.
14:42:24  [Apache]  Press the Logs button to view error logs and check
14:42:24  [Apache]  the Windows Event Viewer for more clues
14:42:24  [Apache]  If you need more help, copy and post this
14:42:24  [Apache]  entire log window on the forums

出現這個錯誤的原因是:端口被占用

我們只需要修改Port(s)即可:

  1. 首先打開XAMPP Control Panel,找到Apache的Config文件:

    click The Config button, and select the Apache (httpd.conf).

    Inside the httpd.conf file, find this line:Listen 80 and this line:ServerName localhost:80,then change the number "80" to the any number you like,for example:"8080". Remember to save this file.

  2. Then select the Apache (httpd-ssl.conf). Inside this file, we should find three lines: 
    • Listen 443
    • <VirtualHost _default_:443>
    • ServerName www.example.com:443    then we can change the number "443" to any number we like, for example "4433". Last we should save this file.

  3. Restart the Apache service.

We can see this when we restart the Apache service:

and this:

15:01:32  [Apache]  Problem detected!
15:01:32  [Apache]  Port 80 in use by ""C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -k runservice" with PID 2820!
15:01:32  [Apache]  Apache WILL NOT start without the configured ports free!
15:01:32  [Apache]  You need to uninstall/disable/reconfigure the blocking application
15:01:32  [Apache]  or reconfigure Apache and the Control Panel to listen on a different port
15:01:32  [Apache]  Attempting to start Apache app...
15:01:32  [Apache]  Status change detected: running

It means we solve this problem.

Then we move to another problem: when we open the localhost, we see this:

To solve this problem, we should change "localhost" to "localhost:8080" ("8080" is your number which you have changed)

Just like this:

 

 

 

 

 

---恢復內容結束---


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM