본문으로 바로가기

리눅스 웹서버(httpd,apache) php 연동방법

category Gift/Linux 2017. 10. 30. 16:01


눅스 웹서버(httpd,apache) php 연동방법



0. Version

[root@localhost ~]# httpd -v

Server version: Apache/2.2.15 (Unix)

Server built:   Oct 19 2017 16:43:38

[root@localhost ~]# php -v

PHP 5.6.29 (cli) (built: Dec  8 2016 08:51:50) 

Copyright (c) 1997-2016 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies


1. httpd.conf 파일 수정

[root@localhost ~]# vi /etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.html.var // 이 부분 찾아서 아래와 같이 추가 -> DirectoryIndex index.html index.html.var index.php index.php3 # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz // 이 부분 찾아서 아래 2줄 추가 후 저장 AddType application/x-httpd-php .php .html .htm .inc AddType application/x-httpd-php-source .phps [root@localhost ~]# service httpd restart // httpd 서비스 재시작 Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@localhost ~]#


2. 연동확인

[root@localhost ~]# vi /var/www/html/phpinfo.php /* 사용자 마다 디렉토리는 다를 수 있음 */

<?php
phpinfo()
?>

위 3줄 입력 후 저장


3. 서버IP/phpinfo.php 접속


'Gift > Linux' 카테고리의 다른 글

CentOS 6 yum update 오류 해결 방법  (7) 2020.12.04
VMware에 칼리리눅스 설치하기  (0) 2017.10.25
CentOS Yum 설치 안될때(2)  (1) 2017.10.01
VI / VIM 명령어 정리  (0) 2017.09.19
CentOS yum 설치시 에러 해결법  (0) 2017.09.18