text/common

자꾸 찾아보기 귀찮아서 쓰는 apache2.4 + php5.x 세팅

hoonzii 2022. 11. 24. 09:04
반응형

까먹을까 봐 쓰는 (자꾸 찾아보기 귀찮아서 쓰는)  아파치 웹서버 + php 세팅

php 버전과 apache 버전이 맞아야 함!!

php ver : 5.4.45 (VC9, win32, x86)
apache 2.4.23 (win32, VC10) -> https://www.apachelounge.com/download/additional/

 

Apache Additional downloads

Keep Server Online If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation. A donation makes a contribution towards the costs, the time and effort that's going in this site and building. Contri

www.apachelounge.com

 

php zip 파일 압축 해제
폴더명 변경 -> php5로 짧게..
폴더 내  "php.ini-develpement" -> "php.ini" 로 수정

"php.ini-develpement" -> "php.ini"

php.ini 파일 내 아래 내용 수정

"extension=php_openssl.dll" 부분의 ";" 제거
"extension_dir="./" 을 "extension_dir = "C:/php5/ext" 로 변경
"short_open_tag = Off" -> "short_open_tag = On"

 


위 아파치 다운로드 후 zip 파일 압축 해제 -> Apache2.4 폴더를 C:/ 로 옮김
Apache2.4/conf/httpd.conf 파일 수정
파일 마지막에 아래 내용 추가

####
LoadModule php5_module "C:/php5/php5apache2_4.dll"
AddType application/x-httpd-php .html .php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/php5"
####



회사 옛날 코드는 apache 5.3 버전에 맞는 코드였기에 아래 버전으로 설치

php 5.3.8 / apache 2.2 -> 로 변경...
php.ini 에 해당 옵션 추가

<!-- ";" 제거 하고~ -->
allow_call_time_pass_reference = On



Apache2/conf/httpd.conf 에 해당 옵션 추가

# dll 버전 확인
LoadModule php5_module "C:/php5.3.8/php5apache2_2.dll"
AddType application/x-httpd-php .html .php
AddHandler application/x-httpd-php .php
# 폴더명 확인
PHPIniDir "C:/php5.3.8"



알아두면 좋은 명령어

httpd -t => conf 변경사항이 syntax error가 나지 않는지 체크 가능
httpd -k install/uninstall => 아파치 httpd 설치/제거
httpd -k start/(stop/shutdown)/restart => 웹서버 실행/중지/재개

httpd -k install
httpd -t
httpd -k stop

 

반응형