# wget http://www.zlib.net/zlib-1.2.5.tar.gz
# tar xvfz zlib-1.2.5.tar.gz
# cd zlib-1.2.5
# ./configure -s
# make
# make test
...
*** zlib test OK ***
# make install
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz # tar xvfz libiconv-1.14.tar.gz # cd libiconv-1.14 # ./configure --prefix=/usr/local # make # make install
# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz # tar xvfz libxml2-2.7.8.tar.gz # cd libxml2-2.7.8 # ./configure \ --prefix=/usr/local/xml \ --with-zlib=/usr/local \ --with-iconv=/usr/local # make # make install
# wget "http://downloads.sourceforge.net/project/freetype/freetype2/2.4.8/freetype-2.4.8.tar.bz2?ts=1321515964&use_mirror=cdnetworks-kr-1" # tar xvfj freetype-2.4.8.tar.bz2 # cd freetype-2.4.8 # GNUMAKE="/usr/sfw/bin/gmake" ./configure # /usr/sfw/bin/gmake # /usr/sfw/bin/gmake install
# wget http://www.libgd.org/releases/gd-2.0.35.tar.bz2 # tar xvfj gd-2.0.35.tar.bz2 # cd gd-2.0.35 # ./configure ... Support for PNG library: yes Support for JPEG library: yes Support for Freetype 2.x library: yes Support for Fontconfig library: yes Support for Xpm library: yes Support for pthreads: yes .... # make # make install
root@wl ~ # wget http://apache.mirror.cdnetworks.com/httpd/httpd-2.2.21.tar.bz2 root@wl ~ # wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz root@wl ~ # tar xvfj httpd-2.2.21.tar.bz2 root@wl ~ # tar xvfz mod_fastcgi-2.4.6.tar.gz root@wl ~ # cd httpd-2.2.21 root@wl ~/httpd-2.2.21 # ./configure \ --prefix=/usr/local/apache2 \ --enable-so \ --enable-auth-digest \ --enable-authn-dbm \ --enable-authn-dbd \ --enable-authz-dbm \ --enable-dav \ --enable-dav-fs \ --enable-dav-lock \ --enable-deflate \ --enable-headers \ --enable-expires \ --enable-dbd \ --enable-dumpio \ --enable-log-forensic \ --enable-rewrite \ --enable-cache \ --enable-file-cache \ --enable-disk-cache \ --enable-mem-cache \ --enable-unique-id \ --enable-proxy \ --enable-proxy-connect \ --enable-proxy-ftp \ --enable-proxy-http \ --enable-proxy-ajp \ --enable-proxy-balancer \ --enable-ssl \ --with-z=/usr/local \ --with-ssl=/usr/local/ssl \ --with-mpm=worker root@wl ~/httpd-2.2.21 # make root@wl ~/httpd-2.2.21 # make install root@wl ~/httpd-2.2.21 # cd ../mod_fastcgi-2.4.6 root@wl ~/mod_fastcgi-2.4.6 # cp Makefile.AP2 Makefile root@wl ~/mod_fastcgi-2.4.6 # make root@wl ~/mod_fastcgi-2.4.6 # make install
root@wl ~ # wget http://kr2.php.net/get/php-5.3.8.tar.bz2/from/kr.php.net/mirror
root@wl ~ # tar xvfj php-5.3.8.tar.bz2
root@wl ~ # cd php-5.3.8
root@wl ~/php-5.3.8 # ./configure \
--prefix=/usr/local/php \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv=/usr/local \
--with-libxml-dir=/usr/local/xml \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-zlib-dir=/usr/local \
--with-freetype-dir=/usr/local \
--with-openssl=/usr/local/ssl \
--with-openssl-dir=/usr/local/ssl \
--enable-fpm \
--enable-calendar \
--enable-mbstring \
--enable-mbregex \
--enable-sigchild \
--enable-gd-native-ttf \
--enable-wddx \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--enable-soap \
--enable-ftp \
--enable-safe-mode \
--enable-exif \
--enable-bcmath \
--enable-zip \
--enable-sqlite-utf8 \
--enable-zend-multibyte
root@wl ~/php-5.3.8 # make
root@wl ~/php-5.3.8 # make install
root@wl ~/php-5.3.8 # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
root@wl ~/php-5.3.8 # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
root@wl ~/php-5.3.8 # chmod +x /etc/init.d/php-fpm
root@wl ~/php-5.3.8 # vi /etc/init.d/php-fpm
#!/bin/sh 를 #!/bin/bash 로 변경
root@wl ~/php-5.3.8 # cp php.ini-development /usr/local/php/lib/php.ini 1)
1) 서비스시에는 php.ini-production 을 기반으로 설정한다.
root@wl ~/php-5.3.8 # ./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ ... root@wl ~/php-5.3.8 # make root@wl ~/php-5.3.8 # make install설치가 완료된 후 httpd.conf 에 FastCGI 설정 대신 아래와 같이 설정해야 한다.
LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
root@wl ~ # vi /etc/profile ... LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apache2/lib; export LD_LIBRARY_PATH PATH=$PATH:/usr/local/apache2/bin; export PATH; root@wl ~ # . /etc/profile
root@wl ~ # vi /usr/local/php/lib/php.ini date.timezone = Asia/Seoul short_open_tag = On include_path = ".:/usr/local/php/lib/php" extension_dir = "/usr/local/php/lib/php/extensions" expose_php = Off upload_max_filesize = 10M post_max_size = 12MPHP-FPM 설정
root@wl ~ # vi /usr/local/php/etc/php-fpm.conf pid = run/php-fpm.pid pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35
root@wl ~ # mkdir /usr/local/apache2/fcgi-bin 1) root@wl ~ # vi /usr/local/apache2/conf/httpd.conf ... # FastCGI Support LoadModule fastcgi_module modules/mod_fastcgi.so 2) <IfModule mod_fastcgi.c> 3) FastCGIExternalServer /usr/local/apache2/fcgi-bin/php-fpm -host 127.0.0.1:9000 -flush -pass-header Authorization AddHandler php5-fcgi php Action php5-fcgi /fcgi-bin/php-fpm Alias /fcgi-bin/ /usr/local/apache2/fcgi-bin/ <Location /fcgi-bin/> Order Deny,Allow Deny from All Allow from All Options ExecCGI SetHandler php5-fcgi </Location> </IfModule> ServerAdmin admin@solanara.net 4) ServerName www.solanara.net:80 4) Include conf/extra/httpd-mpm.conf 5) Include conf/extra/httpd-multilang-errordoc.conf Include conf/extra/httpd-autoindex.conf Include conf/extra/httpd-languages.conf Include conf/extra/httpd-userdir.conf Include conf/extra/httpd-info.conf Include conf/extra/httpd-vhosts.conf Include conf/extra/httpd-manual.conf Include conf/extra/httpd-dav.conf Include conf/extra/httpd-default.conf Include conf/extra/httpd-ssl.conf1) mod_fastcgi 와 관련해 fcgi-bin 디렉토리를 만든다.
root@wl ~ # /etc/init.d/php-fpm start root@wl ~ # /usr/local/apache2/bin/apachectl start종료는 아래와 같이 할 수 있다.
root@wl ~ # /usr/local/apache2/bin/apachectl stop root@wl ~ # /etc/init.d/php-fpm stop
root@wl ~ # vi /usr/local/apache2/htdocs/index.php <?php phpinfo(); ?> root@wl ~ #웹 브라우저를 사용해 http://localhost/index.php 에 접속해본다. php 정보가 제대로 나오는지 확인한다. 아래와 비슷하게 나와야 한다. 확인되었으면 index.php파일을 지운다. (보안때문)

root@wl ~ # rm /usr/local/apache2/htdocs/index.php
|
|
Copyright © 2004-2012 Jo HoSeok. All rights reserved. |