1. php 소스파일 다운로드 및 압축해제

 

http://php.net/releases/

에서 소스 다운로드 및 설치

#tar zxvf ~

 

2. 컴파일에 필요한 패키지 설치

 

php 설치에 필요한 패키지들에 대하여 사전 설치를 진행합니다.

#yum install -y libxml2-devel libcurl-devel gd-devel libmcrypt-devel gdbm-devel libpng-devel libjpeg-devel install freetype-devel

configure: error: mcrypt.h not found. Please reinstall libmcrypt 발생 시에는...

root 계정으로!

#wget http://heanet.dl.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
# tar xvfz libmcrypt-2.5.0.tar.gz
#cd libmcrypt-2.5.0
#./configure && make && make install
#echo "/usr/local/lib" >> /etc/ld.so.conf
#ldconfig

 

3. php소스컴파일 및 설치

 

php소스파일 및 필수 패키지들의 준비가 완료되면 configure 명령어를 통해 설치 구성을 진행합니다.

# configure command 정리

(mysql 없이)
#./configure --prefix=/data/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/data/apache/conf --with-libxml-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir=/usr/lib64 --with-gdbm=/usr/lib64 --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-kerberos --with-gettext --with-openssl --with-mcrypt --with-iconv --with-curl --with-zlib --with-gd --enable-gd-native-ttf --enable-mod-charset --enable-mbstring --enable-sigchild --enable-calendar --enable-sockets --enable-mbregex --enable-bcmath --enable-exif --enable-wddx --enable-soap --enable-ftp --enable-zip --disable-debug

(mysql 같이)
#./configure --prefix=/data/php --with-mysql=/data/mariadb --with-mysqli=/data/mariadb/bin/mysql_config --with-pdo-mysql=/data/mariadb --with-apxs2=/data/apache/bin/apxs --with-config-file-path=/data/apache/conf --with-libxml-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir=/usr/lib64 --with-gdbm=/usr/lib64 --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-kerberos --with-gettext --with-openssl --with-mcrypt --with-iconv --with-curl --with-zlib --with-gd --enable-gd-native-ttf --enable-mod-charset --enable-mbstring --enable-sigchild --enable-calendar --enable-sockets --enable-mbregex --enable-bcmath --enable-exif --enable-wddx --enable-soap --enable-ftp --enable-zip --disable-debug

#make

#make install

 

4. 설치 후 확인 및 설정

 

php 소스 컴파일 설치의 경우 특정 확장자에 대하여php코드가 실행될 수 있도록 아래와 같이 httpd.conf 파일에 해당 내용을 기재하여줍니다.

# httpd.conf 내 추가 내용
<FilesMatch "\.(php|php4|php3|htm|html)$">
      SetHandler application/x-httpd-php



      SetHandler application/x-httpd-php-source




php.ini 가져오기

최초 압축 해제 파일에서, php.ini_development 파일을 복사.
컴파일 시 지정한 php.ini 파일 경로(--with-config-file-path=/data/apache/conf)에다가 php.ini 복사한 후 아래 설정을 한다


설치 후 설정
php 초기 설치 시 일반적으로 이용하기에는 다소 설정이 부족할 수 있습니다. 일반적인 이용을 위하여 다음의 php 환경 설정에 대해 수정이 필요합니다.






# apache httpd.conf 파일 수정

-.htaccess 연동

LoadModule rewrite_module modules/mod_rewrite.so 주석 해제

AllowOverride Non
세 군대 모두 이렇게 변경
AllowOverride All

아래 내용을 추가.!!!


RewriteEngine On

 

5. php.ini 파일의 수정 예제


error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

short_open_tag = On

display_errors = On

allow_url_fopen = On

upload_max_filesize = 200M

memory_limit = 512M

post_max_size = 200M

max_execution_time = 300

max_input_vars = 10000

+ Recent posts