본문 바로가기
프로그램/리눅스

리눅스 php 설치

by 쭌파 2017. 8. 17.

# PHP 설치 버전 : 7.1.8

# 다운로드 경로 : http://php.net


1. 설치전 필수 Library

1
2
3
4
5
6
7
8
9
10
11
12
yum -y install libxml2
yum -y install libxml2-devel
yum -y install bzip2-devel
yum -y install libjpeg-devel
yum -y install libpng-devel
yum -y install libXpm-devel
yum -y install freetype-devel
yum -y install libc-client-devel
yum -y install epel-release
yum -y install php-mcrypt
yum -y install libmcrypt-devel
yum -y install libcurl-devel
cs


2. php 설치

1
2
3
4
cd /usr/local/server
tar zxvf php-7.1.8.tar.gz
cd php-7.1.8
./configure --prefix=/usr/local/server/php --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysqli --enable-sigchild --with-libxml-dir --with-openssl --with-zlib --with-zlib-dir --with-bz2 --enable-calendar --enable-exif --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-curl --enable-curl --with-kerberos --with-iconv --with-mcrypt --enable-mcrypt --enable-bcmath
cs


컴파일 완료시 위와 같은 화면이 나온다.


1
2
make
make install
cs


3. php 설정

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cp php.ini-development /usr/local/server/apache/conf/php.ini
 
# Apache httpd.conf 설정
cd /usr/local/server/apache/conf
vi httpd.conf
 
// php 모듈 추가 확인
LoadModule php7_module        modules/libphp7.so
 
================ 중략 ================
 
// DirectoryIndex 에 index.php 추가
DirectoryIndex index.html index.jsp index.php
 
// php 설정 추가
# PHP7
Include conf/extra/httpd-php7.conf
cs


  - http-php7.conf 파일 생성

1
2
3
4
5
6
7
8
9
cd extra
vi httpd-php7.conf
 
##### 아래 내용 추가 #####
#
#PHPIniDir "conf"
#
AddType application/x-httpd-php .php .html
PHPIniDir "conf"
cs


4. httpd 서비스 재시작

1
service httpd restart
cs


5. 설치 테스트

  1) 정상적으로 설치되었는지 임의의 파일을 생성하여 아래의 소스를 넣어본다.

1
2
3
<?php
phpinfo();
?>
cs


정상적으로 설치가 되었으면 위와같은 화면이 나온다.

'프로그램 > 리눅스' 카테고리의 다른 글

리눅스 MariaDB 소스 설치  (0) 2017.08.17
리눅스 Apache 2.4 설치  (0) 2017.08.17
리눅스 vsftpd ip 접근제한  (0) 2017.04.03
리눅스 사용자계정 생성  (0) 2017.04.03
리눅스 vsftpd 설치 및 설정  (0) 2017.04.03

댓글