우분투 14.04 PHP 5.3 소스설치
리눅스/우분투 2016. 4. 10. 10:54 |PHP-FPM 기준
#Build Essential 설치
apt-get install build-essential
#PHP 의존성 패키지 설치
apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libbz2-dev libjpeg-dev libfreetype6-dev libpng12-dev libxpm-dev libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libt1-dev libgd2-xpm-dev libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev libdb5.3-dev
#PHP 소스 다운로드
wget -O /var/tmp/php-5.3.29.tar.bz2 http://php.net/get/php-5.3.29.tar.bz2/from/this/mirror
#PHP 소스 압축 해제
mkdir -p /opt/build
tar jxf /var/tmp/php-5.3.29.tar.bz2 -C /opt/build
cd /opt/build/php-5.3.29
#PHP 소스 설정
./configure \
--enable-fpm \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-soap \
--enable-sockets \
--enable-zip \
--with-bz2 \
--with-curl \
--with-freetype-dir=/usr \
--with-gd \
--with-gettext \
--with-iconv \
--with-jpeg-dir=/usr/lib \
--with-libxml-dir=/usr/lib \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysql-sock \
--with-mysqli \
--with-openssl \
--with-pdo-mysql \
--with-t1lib=/usr \
--with-zlib \
--prefix=/opt/php-5.3.29 \
--with-config-file-path=/opt/php-5.3.29/etc \
--with-fpm-user=www-data \
--with-fpm-group=www-data
#PHP 컴파일
make
make install
# freetype.h 에러시
mkdir /usr/include/freetype2/freetype
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h
#PHP-FPM 설정
cp /opt/php-5.3.29/etc/php-fpm.conf.default /opt/php-5.3.29/etc/php-fpm.conf
vi /opt/php-5.3.29/etc/php-fpm.conf
[생략]
pid = run/php-fpm.pid
[생략]
user = www-data
group = www-data
[생략]
;listen = 127.0.0.1:9000
listen = /var/run/php53-fpm.sock;
[생략]
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
#PHP-FPM 실행 스크립트 생성
vi /etc/init.d/php53-fpm
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-5.3.29-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-5.3.29-fpm
# Description: starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-5.3.29/sbin/php-fpm
php_fpm_CONF=/opt/php-5.3.29/etc/php-fpm.conf
php_fpm_PID=/opt/php-5.3.29/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-exit"
exit 1
else
echo " done"
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac
#PHP 실행 설정
chmod 755 /etc/init.d/php53-fpm
update-rc.d php53-fpm defaults
#PHP 실행
service php53-fpm start
'리눅스 > 우분투' 카테고리의 다른 글
우분투 14.04 LTS 유니티 업데이트 (2) | 2014.07.09 |
---|---|
우분투 14.04 LTS 한글 이슈 해결 (0) | 2014.07.06 |
우분투 14.04 LTS 정식 출시 (0) | 2014.04.18 |
우분투 14.04 LTS 최종 베타 (0) | 2014.04.18 |
우분투 원, 서비스 종료 (0) | 2014.04.12 |