apacheを動作している状態でnginxをいれるとapacheが動かなくなったことの対応 Apache

apacheを動作している状態でnginxをいれると、apacheが動かなくなったことの対応
apache起動しようとしたが動かない。
メッセージでないし、コマンドラインから実行すると以下のようなことが原因らしい。


httpd.exe: Syntax error on line 456 of D:/xampp/apache/conf/httpd.conf: Syntax e
rror on line 19 of D:/xampp/apache/conf/extra/httpd-xampp.conf: Cannot load D:/x
ampp/php/php5apache2_4.dll into server: ¥x8ew¥x92¥xe8¥x82¥xb3¥x82¥xea¥x82¥xbd¥x8
3v¥x83¥x8d¥x83V¥x81[¥x83W¥x83¥x83¥x82¥xaa¥x8c¥xa9¥x82¥xc2¥x82¥xa9¥x82¥xe8¥x82¥xd
c¥x82¥xb9¥x82¥xf1¥x81B

Apache konnte nicht gestartet werden
Apache could not be started

httpd.exe: Syntax error on line 456 of D:/xampp/apache/conf/httpd.conf: Syntax e
rror on line 19 of D:/xampp/apache/conf/extra/httpd-xampp.conf: Cannot load D:/x
ampp/php/php5apache2_4.dll into server: ¥x8ew¥x92¥xe8¥x82¥xb3¥x82¥xea¥x82¥xbd¥x8
3v¥x83¥x8d¥x83V¥x81[¥x83W¥x83¥x83¥x82¥xaa¥x8c¥xa9¥x82¥xc2¥x82¥xa9¥x82¥xe8¥x82¥xd
c¥x82¥xb9¥x82¥xf1¥x81B

httpd-xampp.conf: Cannot load php5apache2_2.dll into server:
Apache konnte nicht gestartet werden
Apache could not be started


Windowsであるポート番号を使用しているプロセスを調べる方法
コマンドプロンプトに下記のコマンドを打ち込みます
まず、ポート番号を使っているPIDを調べます(例は80番のポートを調べる場合)
netstat -nao|find 80
次に、PIDからプロセス名を調べます(例はpidが3296のプロセスを調べる場合)
tasklist /fi pid eq 3296


12:57:55 [Apache] Apache WILL NOT start without the configured ports free!
12:57:55 [Apache] You need to uninstall/disable/reconfigure the blocking application
12:57:55 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
12:57:55 [main] The FileZilla module is disabled
12:57:55 [main] The Mercury module is disabled
12:57:55 [main] The Tomcat module is disabled
12:57:55 [main] Starting Check-Timer
12:57:55 [main] Control Panel Ready

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


・apacheが起動しなかった対応
xampp いれなおした
apache startすると画面に以下のメッセージ
12:57:55 [Apache] Apache WILL NOT start without the configured ports free!
12:57:55 [Apache] You need to uninstall/disable/reconfigure the blocking application
12:57:55 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
12:57:55 [main] The FileZilla module is disabled
12:57:55 [main] The Mercury module is disabled
12:57:55 [main] The Tomcat module is disabled
12:57:55 [main] Starting Check-Timer
12:57:55 [main] Control Panel Ready

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

・エラーログに以下のメッセージ
[Sun Jan 10 12:52:38.201949 2016] [ssl:warn] [pid 4548:tid 244] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 12:52:39.051251 2016] [ssl:warn] [pid 4548:tid 244] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 12:52:39.461953 2016] [mpm_winnt:notice] [pid 4548:tid 244] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.15 configured -- resuming normal operations
[Sun Jan 10 12:52:39.461953 2016] [mpm_winnt:notice] [pid 4548:tid 244] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Sun Jan 10 12:52:39.461953 2016] [core:notice] [pid 4548:tid 244] AH00094: Command line: D:¥¥xampp¥¥apache¥¥bin¥¥httpd.exe -d D:/xampp/apache
[Sun Jan 10 12:52:39.481953 2016] [mpm_winnt:notice] [pid 4548:tid 244] AH00418: Parent: Created child process 3588
[Sun Jan 10 12:52:41.611959 2016] [ssl:warn] [pid 3588:tid 256] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 12:52:42.443161 2016] [ssl:warn] [pid 3588:tid 256] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 12:52:42.677464 2016] [mpm_winnt:notice] [pid 3588:tid 256] AH00354: Child: Starting 150 worker threads.


どうやら プロセスID 4548 が悪さしてるっぽい。
プロセスID 4548をつかってるのは何かを調べる
次に、PIDからプロセス名を調べます(例はpidが4548のプロセスを調べる場合)
C:¥>tasklist /fi pid eq 4548
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
httpd.exe 4548 Console 1 17 168 K


というわけで、あとは cmd から プロセス > httpd.exe を探して
kill した。
どうやら前回のが残ってたのかな

ちなみに killする前に netstat で このプロセスをさがしたらこうなってた
C:¥>netstat -nao|find 4548
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4548
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 4548
TCP [::]:80 [::]:0 LISTENING 4548
TCP [::]:443 [::]:0 LISTENING 4548

これでapache動くようになった。
nginxが原因かどうかはわからんが、とりあえずいいや