centos8 에서 .html 도 php 작동하게 설정하기 > 리눅스

본문 바로가기

회원로그인

회원가입

리눅스

레드햇 centos8 에서 .html 도 php 작동하게 설정하기

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 23회 작성일 23-09-14 00:31

본문

php 코드를 html 파일에서 작동시키기

# vi /etc/httpd/conf.d/php.conf

AddType text/html .php .html .htm
DirectoryIndex index.php index.html index.htm


<IfModule  mod_php7.c>
    <FilesMatch \.(php|phar|html|htm)$>
        SetHandler application/x-httpd-php
    </FilesMatch>

    php_value session.save_handler "files"
    php_value session.save_path    "/var/lib/php/session"
    php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"

    #php_value opcache.file_cache   "/var/lib/php/opcache"
</IfModule>

# Redirect to local php-fpm if mod_php (5 or 7) is not available
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar|html|htm)$>

        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>


# vi /etc/php-fpm.d/www.conf
security.limit_extensions = .php .php3 .php4 .php5 .php7 .html    // 주석 해제 및 확장자 추가
listen.allowed_clients = 0.0.0.0    // 수정



> systemctl restart httpd
> systemctl restart php-fpm

댓글목록

등록된 댓글이 없습니다.