LoginSignup
0
1

More than 1 year has passed since last update.

【実践】XAMPPのApache&MariaDBサービス競合エラー解消法

Last updated at Posted at 2022-04-15

web系のサーバーサイドエンジニアを目指す奴のメモ書きです。
環境:windows10

XAMPPのエラーを解消する

image.png

今回出たエラーはこちら!

20:33:57  [Apache] 	Apache Service detected with wrong path
20:33:57  [Apache] 	Change XAMPP Apache and Control Panel settings or
20:33:57  [Apache] 	Uninstall/disable the other service manually first
20:33:57  [Apache] 	Found Path: "c:\Apache24\bin\httpd.exe" -k runservice
20:33:57  [Apache] 	Expected Path: "d:\xampp\xampp\apache\bin\httpd.exe" -k runservice
20:33:57  [Apache] 	Problem detected!
20:33:57  [Apache] 	Port 80 in use by ""c:\Apache24\bin\httpd.exe" -k runservice" with PID 3868!
20:33:57  [Apache] 	Apache WILL NOT start without the configured ports free!
20:33:57  [Apache] 	You need to uninstall/disable/reconfigure the blocking application
20:33:57  [Apache] 	or reconfigure Apache and the Control Panel to listen on a different port
20:33:57  [mysql] 	Problem detected!
20:33:57  [mysql] 	Port 3306 in use by ""C:\Program Files\MariaDB 10.5\bin\mysqld.exe" "--defaults-file=C:\Program Files\MariaDB 10.5\data\my.ini" "MariaDB""!
20:33:57  [mysql] 	MySQL WILL NOT start without the configured ports free!
20:33:57  [mysql] 	You need to uninstall/disable/reconfigure the blocking application
20:33:57  [mysql] 	or reconfigure MySQL and the Control Panel to listen on a different port

何のことかわからないのでまずは翻訳

20:33:57[Apache]Apacheサービスが間違ったパスで検出されました
20:33:57 [Apache]XAMPPApacheとコントロールパネルの設定を変更するか
20:33:57[Apache]最初に他のサービスを手動でアンインストール/無効にします
20:33:57 [Apache]検出されたパス: "c:\ Apache24 \ bin \ httpd.exe" -k runservice
20:33:57 [Apache]予想されるパス: "d:\ xampp \ xampp \ apache \ bin \ httpd.exe" -k runservice
20:33:57 [Apache]問題が検出されました!
20:33:57[Apache]ポート80が""c:\ Apache24 \ bin \ httpd.exe "-krunservice"によってPID3868で使用されています。
20:33:57 [Apache]設定されたポートが空いていないと、Apacheは起動しません!
20:33:57[Apache]ブロックしているアプリケーションをアンインストール/無効化/再構成する必要があります
20:33:57 [Apache]または、別のポートでリッスンするようにApacheとコントロールパネルを再構成します
20:33:57 [mysql]問題が検出されました!
20:33:57[mysql]ポート3306が""C:\ Program Files \ MariaDB 10.5 \ bin \ mysqld.exe "" --defaults-file = C:\ Program Files \ MariaDB 10.5 \ data\myで使用されています。 ini "" MariaDB ""!
20:33:57 [mysql] MySQLは、構成されたポートが空いていないと起動しません!
20:33:57[mysql]ブロッキングアプリケーションをアンインストール/無効化/再構成する必要があります
20:33:57 [mysql]または、MySQLとコントロールパネルを再構成して、別のポートでリッスンします

XAMPPにはApacheとMariaDBが同梱されているんだけど、もともと自分のPCにApacheとMariaDBが入っていて、しかもサービスが起動しているからポートをとりあってしまっているということのようだ。
AppachもMariaDBもXAMPPでまとめて管理する方が楽だからもともとあった方を何とかするよ!

まずはApacheから解消する

もともと入っていたApacheは全然使っていなかったから今回はアンインストールしようと思う。

Apacheのサービスが動いている場合はアンインストールする前にサービスを停止するのがよい。

サービスとして登録した Apache をサービスから削除したい場合にはまず Apache を停止した上で「httpd -k uninstall」と実行して下さい。
https://www.javadrive.jp/apache/install/index3.html

管理者権限でコマンドプロンプトを立ち上げて下記コマンドをC:\Apache24\binに移動して実行

httpd.exe -k uninstall

-kは起動、停止、インストール、アンインストールを選択するときにつける奴。

実行結果

C:\WINDOWS\system32>cd C:\Apache24\bin

C:\Apache24\bin>httpd.exe -k uninstall
Removing the 'Apache2.4' service
The 'Apache2.4' service has been removed successfully.

\「Apache2.4」サービスは正常に削除されました。/

サービスが消えているか確認しに行く

「Windows + X」キー➡「コンピューターの管理」を選択で
コンピューターの管理が開いたら「サービスとアプリケーション」➡「サービス」
image.png

サービスの停止を忘れてアンインストールした君へ

サービス停止しないでアンインストールしたらサービスが生きてやがりました。
その場合は手動で停止してあげればサービスから消えます。

Apacheのサービスを消してXAMPPを開くと・・・・

Apacheのエラーがめでたく解消!
image.png

もともと入っていたApacheは使う予定がないのでフォルダも削除しちゃいました。
アンインストールしただけではフォルダはそのまま残るので消したい場合は忘れずに!

次はMariaDBを解消する

Mariadbは時々使っていて何かデータが入っている気がするので残しておく。
デフォルトだとPC起動時にサービスが起動してしまうので勝手にサービスが起動しないように設定を変更する。

またサービス一覧を見に行く

「Windows + X」キー➡「コンピューターの管理」を選択で
コンピューターの管理が開いたら「サービスとアプリケーション」➡「サービス」
MariaDBが実行中になっている。
image.png

サービスをダブルクリックするとポップアップが開く
image.png
スタートアップの種類を手動に切り替える。
こうすることでPC起動時にサービスが起動してしまうのを防げる。

手動になったのを確認してサービスの停止を選択
image.png

おまけ:サービスの停止とサービスの一時停止

サービスが一時停止されると、キャッシュされた情報や場合によっては待機中の作業項目のキューなど、内部状態を維持できます。 その後、サービスは再開して中断した場所から再開することができます。
サービスが停止すると、内部状態は破棄されます。 サービスを再開すると、すべての初期化が繰り返されます。
開発者は両者を区別します。 サービスに重要な初期化プロセスがある場合、この区別は非常に重要です。
https://code-examples.net/ja/q/ed60ce

サービスの停止ができたらXAMPPを起動してみる

image.png
\エラー解消/

参考資料
https://itojisan.xyz/settings/24490/#:~:text=%E3%80%8CWindows%20%2B%20X%E3%80%8D%E3%82%AD%E3%83%BC%E3%82%92,%E4%B8%80%E8%A6%A7%E3%81%8C%E8%A1%A8%E7%A4%BA%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82
https://www.javadrive.jp/apache/install/index3.html
https://webkaru.net/php/windows-apache-uninstall/
https://code-examples.net/ja/q/ed60ce

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1