2016년 10월 7일 금요일

Apache PHP Mysql on CentOS 6

# yum clean all

필요시 시스템 시간 수정
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

# yum install rdate
# rdate -s time.bora.net && /sbin/clock -w

필요시 crontab 등록
iptable 에 time.bora.net의 IP 예외 처리.

사전 패키지 설치
# yum install gcc gcc-c++ libjpeg* libpng* freetype* gd-*

기존 설치 여부 체크
# rpm -qa | egrep "^(httpd|php|mysql)" | sort -n

기존 SW 삭제
# yum remove php*
# yum remove mysql*
# yum remove httpd*


* 웹서버 Apache 설치
Install Apache

# yum install httpd*

# vi /etc/httpd/conf/httpd.conf

User nobody
Group nobody

ServerAdmin itswisek@gmail.com

ServerName localhost

DocumentRoot "/www/www.wsol.kr"

짧은 주소를 이용하고 싶다면 추가
LoadModule rewrite_module modules/mod_rewrite.so

DirectoryIndex index.html index.htm index.php

ServerSignature Off

#AddDefaultCharset UTF-8

맨밑에 추가
AddType application/x-httpd-php .php .php3 .html .htm .inc
AddType application/x-httpd-php-source .phps


각 호스트 등록
# vim /etc/httpd/conf.d/httpd-vhosts.conf


시스템 시작시 서비스 자동 시작 처리
# chkconfig httpd on



* Install MySQL 5.6

# yum install mysql mysql-devel mysql-libs mysql-server


환경 설정 : 메모리 용량에 맞게 샘플 설정 파일 복사
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

# vim /etc/my.cnf

[client]
default-character-set = utf8

[mysqld]

#skip-locking (deprecated 됨. 아래 것을 사용)
skip-external-locking

character-set-client-handshake = FALSE
init_connect = "SET collation_connection = utf8_general_ci"

# utf8과 euckr 모두 사용하기 위해 주석처리하고 아래에 binary로 사용
#init_connect = "SET NAMES utf8"
init_connect = "SET NAMES binary"

# 최신버전에선 사용하지 않으므로 에러시 주석처리
#default-character-set = utf8

character-set-server = utf8
collation-server = utf8_general_ci

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8


# service mysqld start

mysql root 암호 설정
# /usr/bin/mysqladmin -u root password 'new-password'

계정 처리
# mysql -u root -p mysql
select * from user;

시스템 시작시 서비스 자동 시작 처리
# chkconfig mysqld on
# chkconfig  --list | grep mysqld


* Install PHP

# yum --enablerepo=webtatic install php56w

# yum --enablerepo=webtatic install php56w-bcmath php56w-gd php56w-mbstring php56w-mcrypt php56w-mysql php56w-opcache php56w-pear php56w-pecl-geoip php56w-tidy php56w-xml php56w-xmlrpc

php56w-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php56w-gd.x86_64 : A module for PHP applications for using the gd graphics library
php56w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php56w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php56w-mysql.x86_64 : A module for PHP applications that use MySQL databases
php56w-opcache.x86_64 : An opcode cache Zend extension
php56w-pear.noarch : PHP Extension and Application Repository framework
php56w-pecl-geoip.x86_64 : Extension to map IP addresses to geographic places
php56w-tidy.x86_64 : Standard PHP module provides tidy library support
php56w-xml.x86_64 : A module for PHP applications which use XML
php56w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
# vi /etc/opt/remi/php70/php.ini

short_open_tag = Off

disable_functions = "system,exec,shell_exec,passthru,proc_open"

expose_php = Off

memory_limit = 128M (필요시 수정)

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED

포스트 하나당 총 파일사이즈(파일첨부 최대 사이즈보다 커야함)
post_max_size = 100M

파일첨부 최대 사이즈
upload_max_filesize = 100M

allow_url_fopen = Off

date.timezone = "Asia/Seoul"

필요시 수정
session.name = WSOLSESSID

session.gc_maxlifetime = 86400
# chown -R root:nobody /var/lib/php/session/
(바꾼 apache user group으로 수정)

restart Apache service.
# service httpd restart


방화벽 오픈 Open Port in Firewall
for http (80) and https (443) services


설치된 버전 체크 Check Installed Version

# php -v
PHP 5.6.25 (cli) (built: Aug 20 2016 09:39:48)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

# vi phpinfo.php


# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jul 18 2016 15:24:00


# mysql -V
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1


메일 서비스 설치
# yum install postfix


댓글 없음:

댓글 쓰기