Search
💻

[Apache] 아파치 html에서 php 코드 인식 가능하도록 하기

[파일경로]

/etc/apache2/mods-enabled/mime.conf

[파일내용]

#AddHandler cgi-script .cgi # # For files that include their own HTTP headers: # #AddHandler send-as-is asis # # For server-parsed imagemap files: # #AddHandler imap-file map # # For type maps (negotiated resources): # (This is enabled by default to allow the Apache "It Worked" page # to be distributed in multiple languages.) # AddHandler type-map var # # Filters allow you to process content before it is sent to the client. # # To parse .shtml files for server-side includes (SSI): # (You will also need to add "Includes" to the "Options" directive.) # AddType text/html .shtml <IfModule mod_include.c> AddOutputFilter INCLUDES .shtml </IfModule> </IfModule>
Shell
복사

[코드추가]

AddType application/x-httpd-php .html

[수정된 코드]

#AddHandler cgi-script .cgi # # For files that include their own HTTP headers: # #AddHandler send-as-is asis # # For server-parsed imagemap files: # #AddHandler imap-file map # # For type maps (negotiated resources): # (This is enabled by default to allow the Apache "It Worked" page # to be distributed in multiple languages.) # AddHandler type-map var # # Filters allow you to process content before it is sent to the client. # # To parse .shtml files for server-side includes (SSI): # (You will also need to add "Includes" to the "Options" directive.) # AddType text/html .shtml AddType application/x-httpd-php .html <IfModule mod_include.c> AddOutputFilter INCLUDES .shtml </IfModule> </IfModule>
Shell
복사

[서버 재시작 or 다시로딩]

$ service apache2 reload
Shell
복사
Last updated @3/30/2023
Copyright 2023, 실전코딩 All Rights Reserved.