기타 개발 관련

[Window] 아파치 설치 후 실행(start) 안 될 때 해결방법 (The requested operation has failed, AH00378: Failed to start the 'Apache2.4' service)

9yeah 2022. 2. 11. 16:52

~공부 없이 문제 하나 생기면 구글링하며 해결해온 웹알못입니다~

 

발단

C드라이브에 아파치 구축하여 그누보드 게시판 사용중 문제 발생하여

그냥 C드라이브에 있던 Apache24 폴더 통째로 단순 삭제휴지통행하고,

(그 외 php 폴더 삭제, mysql 해당 database drop만 함)

 

환경변수 건든 것 다 까먹고 그대로 Apache 파일 다운받아 이번엔 D드라이브에 설치해보려 하니

다음과 같은 문제 발생함.

 

상황

D드라이브에 Apache24 폴더 넣고 (httpd.conf 파일 수정, 시스템 변수 설정은 다시 함)

관리자 권한 명령 프롬프트 실행하여

httpd -k install

httpd -k start

했는데 아무 에러문 출력 없어서 된 줄 알았지만 localhost 안 뜸

 

D:\Apache24\bin\ApacheMonitor.exe 실행해서 start 하면 

"The requested operation has failed!"에러창이 뜸.

 

D:\Apache24\logs\error 에서 에러 로그 확인해보니

(OS 2)지정된 파일을 찾을 수 없습니다. : AH00378: Failed to start the 'Apache2.4' service

가 써있었음

 

 

해결방법

 

윈도우 검색창에 "서비스" 검색 후 실행

리스트들 중 "Apache2.4" 더블 클릭하여 실행 파일 경로 확인하기

먄약, 내가 Apache24 폴더를 넣은 디렉토리와 다르다면

(나는 이전에 설정됐던 대로 C드라이브로 잡혀있었음. 사진은 수정한 후임)

 

"레지스트리 편집기" 실행하여

"apache"를 검색하고

두 개 다 '이름 바꾸기'로 C->D로 변경

 

이후 명령프롬프트 관리자 권한으로 실행

D:\>cd Apache24

D:\Apache24>httpd.exe -k install -n "Apache"
Installing the 'Apache' service
The 'Apache' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.

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

D:\Apache24>httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.

D:\Apache24>cd bin

D:\Apache24\bin>httpd -n "Apache2.4" -t
Syntax OK

D:\Apache24\bin>httpd -k start

D:\Apache24\bin>

 

이 순서로 입력하면 아파치 실행 됨!

...

근데

 

Apache는 지워도 될 것도 같지만 무서우니까 일단 안지우겠음

 

 

 

꿑!