【XAMPP】Apacheが起動しなくなった時の原因・対処法
調査範囲 (関連ファイル)
今回、調査したファイルは以下の通り
パス |
ファイル名 |
---|---|
C:\Windows\System32\drivers\etc | hosts |
C:\xampp\apache\conf | httpd.conf |
C:\xampp\apache\conf\extra | httpd-vhosts.conf |
原因
httpd.conf 内の記述に不適切な箇所があった。
結論として、
XAMPPで複数サイトのバーチャルホスト設定をするため、
以下のコメントアウトを外していました。
それが今回の問題原因だったようです。
# Virtual hosts Include conf/extra/httpd-vhosts.conf
エラー原因発見までの経緯
2. XAMPP コントロールパネルでのエラーメッセージ
XAMPPのコントロールパネルでは、以下エラーメッセージが確認されました。
《エラーメッセージ》
17:56:56 [Apache] Status change detected: stopped
17:56:56 [Apache] Error: Apache shutdown unexpectedly.
17:56:56 [Apache] This may be due to a blocked port, missing dependencies,
17:56:56 [Apache] improper privileges, a crash, or a shutdown by another method.
17:56:56 [Apache] Press the Logs button to view error logs and check
17:56:56 [Apache] the Windows Event Viewer for more clues
17:56:56 [Apache] If you need more help, copy and post this
17:56:56 [Apache] entire log window on the forums
3. XAMPP で Apacheエラーログを確認
エラーログには、以下のような記録が…
Warning: DocumentRoot [C:/xampp/htdocs/(ファイル名)] does not exist
確認したら、現在このパス + ファイルは存在しなくなっていたので、hostsファイル、httpd.confファイルにあった該当箇所を削除、上書き更新しました。
が、問題は解消せず。
これは要因ではなかったよう。
エラー発生前の記述に戻す(httpd.conf)
今回の複数の修正箇所をたどり、一つ一つ、エラー発生前の記述に戻していきながら動作確認
↓
発見、
原因はここでした。
《修正前》
コメントアウトなし
# Virtual hosts Include conf/extra/httpd-vhosts.conf
《修正後》
再度コメントアウトし、ファイルを更新、
# Virtual hosts #Include conf/extra/httpd-vhosts.conf
ん~、でもなんでだろう?
パスは間違ってないと思うんだけど。。。
今回の反省点
複数の修正をまとめて行ってしまっていたため、
問題の切り分け、原因特定に多少時間を要してしまいました。
作業にあたり、
- 変更作業の記録
- 変更前ファイルのバックアップ
は抜かりなく、
が作業上の基本、かつ、重要ポイントですね。