2016年7月16日土曜日

インストールしたXAMPPからApacheが起動しない

WebサーバーのApacheやら、
データベースのMySQLやらが入ってて
サクッと環境構築できて便利なXAMPPをインストール。

いざ、Apacheを起動しようとしたら
以下のエラーがでました。
---------------------------------------------------------------------------------
[Apache] Problem detected!
[Apache] Port 80 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID 2732!
[Apache] Apache WILL NOT start without the configured ports free!
[Apache] You need to uninstall/disable/reconfigure the blocking application
[Apache] or reconfigure Apache and the Control Panel to listen on a different port
[Apache] Problem detected!
[Apache] Port 443 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID 2732!
[Apache] Apache WILL NOT start without the configured ports free!
[Apache] You need to uninstall/disable/reconfigure the blocking application
[Apache] or reconfigure Apache and the Control Panel to listen on a different port

---------------------------------------------------------------------------------

Skypeが使っているポートとかぶってるよって事らしいです。

解決策

(1) Skypeの設定を変更する。
 1.Skypeを起動
 2.Skypeのメニューのツール - 設定 - 詳細 - 接続 を開いて
   「追加の受信接続にポート80と443を使用」のチェックを外す。
 3.Skypeを再起動

再度Apacheを起動してみて
起動したらおっけー。
終わり

(2) Apacheの設定を変更する。
 1.XAMPP Control Panelを起動
 2.Modules枠内ApacheのActionsにある
   Configをクリックし「Apache(httpd.conf)」をクリック(テキストエディタが開く)
 3.Listen 80と書かれた箇所を別のポート番号に変更する (例:Listen 8080)
   変更後ファイルを保存して閉じる
 4.同様に「Apache(httpd-ssl.conf」も開き変更保存し閉じる
   (変更箇所:Listen 443 例:Listen 44380)
   この時点で起動可能になるが毎回エラーメッセージが出るので追加で変更をする
 5.右側に並んだメニューにあるConfigをクリック
   「Configuration of Control Panel」が表示される
 6.Service and Port Settingsをクリック
   「Service Settings」が表示される
 7.Apacheタブを表示する
 8.「Main Port」、「SSL Port」を3.と4.で設定したListenの値に変更する
   例:Mai Portは8080、SSL Portは44380
 9.「Service Settings」、「Configuration of Control Panel」をSaveを押して順に閉じる
 
再度Apacheを起動してみて
起動したらおっけー。
終わり

変更に使用するポートについて補足(これに注意してると無難かな?)
 1.コマンドプロンプトから以下のコマンドを実行し、使用されていないポート番号を使用する。
   netstat -aon
   (ちなみにポートはローカルアドレス列に「アドレス:ポート番号」で表記されています)
 2.well-known portsは使用しない。


以上です。