레이블이 php인 게시물을 표시합니다. 모든 게시물 표시
레이블이 php인 게시물을 표시합니다. 모든 게시물 표시

20150624

'PHP 7'에 대해 반드시 알아야 할 것 5가지

어제 Zend사의 뉴스레터로 재미있는 것이 왔습니다. 바로 PHP의 다음 버전인 'PHP 7'에 대한 것입니다. "'PHP 7'에 대해 반드시 알아야 할 것 5가지"라는 거창한(?) 제목의 메일인데 본문에는 'PHP 7'에 대한 인포그래픽 페이지로의 링크를 가지고 있었습니다. 그 인포그래픽 페이지에 있는 내용을 정리해보겠습니다. 참고로 현재 PHP의 최신 버전이 5.6인데 차기 버전 넘버가 7이 된 것은 개발이 취소된 'PHP 6'와의 구별을 위한 것이라고 합니다.

1. 'PHP 7'은 2015년 10월 릴리즈 예정

2015년 6월 중순에 RC 버전이 나오고 10월 중순에 릴리즈가 목표라고 합니다.


2. 복합연산자 도입

루비 등에 있는 <=> 복합연산자가 도입됩니다. strcmp()와 비슷한 동작을 하는 함수인데 문자 타입에 대한 비교를 하는 strcmp()와는 달리 <=> 복합연산자는 배열이나 객체에도 사용할 수 있는 것이 다릅니다. usort() 함수의 콜백 함수와 같이 정렬 기능을 만들때 효율적이라고 합니다.


3. 함수 리턴 타입 선언 및 스칼라 타입 힌트 추가

이제 PHP도 Java와 같은 언어처럼 함수의 리턴 타입을 선언할 수 있습니다. 거기에 기존 'PHP 5'에서는 데이터 타입 힌트를 배열과 객체에만 사용할 수 있었는데 일반 스칼라 타입에도 타입 힌트를 사용할 수 있게 되었습니다.


4,5. 빠른 속도

4번과 5번 항목은 속도에 대한 이야기입니다. '빠르다. 그리고, 점점 더 빨라지고 있다' (ㅡ.ㅡ;) Zend쪽에서는 페이스북이 만든 HHVM보다 빠르다라고 이야기하는 것 같습니다. 현재 기준으로 'PHP 7'이 PHP 5.6보다 25%에서 최대 70% 정도까지 성능향상이 있다고 합니다.



http://www.just4fun.kr/2015/03/php-7-5.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+just4fun%2FIZeD+%28just+for+fun%29

HHVM下fastcgi_finish_request的替代方案

最近在研究与迁移HHVM,在过程中遇到不少坑,比如遇到了fastcgi_finish_request这个函数问题。

fastcgi_finish_request是由FPM特供的一个函数,主要实现了在结束http请求之后,php-cgi仍然继续执行fastcgi_finish_request后面的代码,可以实现的一个简单的异步操作,具体使用可以参考之前的文章:《使用fastcgi_finish_request()提高请求响应速度》

在不断摸索之后,终于找到了HHVM下fastcgi_finish_request的替代方案,

HHVM 也提供了一个类似的函数:register_postsend_function


以上是HHVM官方的idl,对此函数的描述,它实现了类似fastcgi_finish_request的功能,由于官方wiki非常少,
在尝试之后,此函数的使用方式如下:
register_postsend_function是注册一个回调函数用于http请求结束时触发,参数类似call_user_func,

用法如下:



中第一个参数为回调函数,可以是一个匿名函数,也可以是预定义的函数,也可以是类的公共函数或静态函数,
后续的参数对应于传入回调函数的形参。

如:


或者:



以上两个例子中的$a对应于传入的形参$bar
在类中使用如下


使用注意:

因为register_postsend_function是注册回调函数,并且是在http结束之后才会触发,

并不像fastcgi_finish_request是直接在上下文中,
所以它并没有保持发起此函数时的上下文,回调函数里面的现场需要显式的还原,可以通过函数参数来还原现场。

使用fastcgi_finish_request()提高请求响应速度

当PHP运行在FastCGI模式时,PHP FPM提供了一个名为fastcgi_finish_request的方法.按照文档上的说法,此方法可以提高请求的处理速度,如果有些处理可以在页面生成完后再进行,就可以使用这个方法.
听起来可能有些茫然,我们通过几个例子来说明一下:


通过浏览器访问此脚本, 结果发现并没有输出相应的字符串,但却生成了相应的文件.由此说明在调用fastcgi_finish_request后,客户端响应就已经结束,但与此同时服务端脚本却继续运行!
合理利用这个特性可以大大提升用户体验,趁热打铁再来一个例子:



代码里用sleep模拟一些耗时的操作,浏览时没有被堵塞,程序却都执行了,具体看日志.
末了给您提个醒,Yahoo在Best Practices for Speeding Up Your Web Site中提到了Flush the Buffer Early,也就是利用PHP中的flush方法把内容尽快发到客户端去,它和本文介绍的fastcgi_finish_request有些许的类似.
转载附言: 我看了下这个方法, 在调用的时候, 会发送响应, 关闭连接. 但是不会结束PHP的运行. 相比调用flush, 或者我之前介绍的加速你的Echo来说, 这个方法能更加干脆一些.
另外, 从代码的可移植性讲的话, 可以在代码中附上如下代码:


http://www.laruence.com/2011/04/13/1991.html

20130821

PHP의 Swatch Internet Time

일별 로그나 데이터 관리 부분에서 시간별로 관리하기에는 데이터가 많고 분단위로 관리나 초 단위로 관리를 하기에는 depth가 많아지거나 구성 폴더가 많아지게 된다.

그래서 나는 Swatch internet Time(하루를 1000으로 나누는 거)으로 많이 활용하는데...

php 에서는 date('B')로 사용법이 간단하지만 shell이나 python 에서는 조금 애매하다..

Swatch Internet Time 의 공식은 아래와 같다.



function getinternettime()
{
  return((float) ((time()+3600) % 86400) / 86.4);
}


or C:
float getinternettime(NULL)
{
  return((float) ((time(NULL)+3600) % 86400) / 86.4);
}
or PERL:
sub getinternettime
{
  return(((time()+3600) % 86400) / 86.4);
}
or CFSCRIPT (submitted by Bruce Kiefer http://www.bruceandmo.com):
<cfscript>
 /**
 * Get current Swatch Internet Time (sIT)
 * The goal of sIT may be commercial, but a base10 clock is wonderful
 * Can be very useful in timestamps and other variables
 * This function should self adjust for your UTC offset
 * See http://www.ypass.net for PHP and Perl versions
 * See http://www.swatch.com for information
 *
 * @return function returns a string
 * @author packetsdontlie@mac.com
 * @version 1, 12 April 2002
 */
function swatchIT(){
 var myutc = GetTimeZoneInfo();
 var beats = ((3600 + Val(Hour(now()) * 3600) + Val(Minute(now()) *
   60) + Second(now()) + val(myutc.utcTotalOffset)) mod 86400) / 86.4;
 return decimalformat(beats);
}
</cfscript>

20130710

php errors

configure: error: xml2-config not found. Please check your libxml2 installat

yum install libxml2

yum install libxml2*

configure: error: no acceptable cc found in $PATH 

yum -y install gcc-c++

configure: error: cannot find output from lex; giving up flex is not installed, install flex. 

yum -y install flex

configure: error: xml2-config not found. Please check your libxml2 installation. 

yum -y install libxml2-devel 

configure: error: Cannot find OpenSSL's 

yum -y install openssl-devel 

configure: error: Please reinstall the BZip2 distribution 

yum -y install bzip2-devel 

configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/ 

yum -y install curl-devel

configure: error: libjpeg.(a|so) not found. 

yum -y install libjpeg-devel 

configure: error: libpng.(a|so) not found. 

yum -y install libpng-devel 

configure: error: freetype2 not found! 

yum -y install freetype-devel 

configure: error: Unable to locate gmp.h 

yum -y install gmp-devel 

configure: error: Cannot find pspell 

yum -y install aspell-devel

20130709

PHP Sessions in Memcache – Locking Issues

Actually it is ages since I sat down to scribble something. Well this one could not be avoided. Hence here it is.
In one of our FTE projects, we had faced a complication that Memcached on one node was using 100% cpu and php-cgi was complainging that the same node was not permitting any more memcached connections. The configuration was as what all says, session.save_handler = memcache, session.save_path = “tcp://:11211,tcp://:11211,tcp://:11211″. It was giving jitters to the night support, that this used to happen at the worse time when most of the clients are using the application. And eventually that memcached needed to be restarted, kicking all users out and every one has to login back from the login page. Now during the past weeks it was so horrible that we marked a portion of the ramdisk from one least loaded nodes and used nfs to export this to all the nodes for a file based sessions store.

To explain things more, our application written using the extJS javascript framework wrapped in a custom php framework, was having ajax and frames, with php sessions. Means any one request will lock the sessions till that request is completed, so at some point in the course of work, there was some database deadlocks which might have loaded one or two php requests tieing down the sessions. Memcached is not designed to work like this, and locking the tcp:// would cause the system to block any further php requests to the memcached daemon.
Armed with all these informations, I tried to find a custom solution which may be blocks only the particular connection or to be explicit, the exact browser-php-session would be blocked, and would not affect any other sessions. I expanded a User Contributed Note from php maualsession_set_save_handler to build my first version which is reproduced below.

<?php
 
class SessionSaveHandler {
    protected 
$mc;
 
    public function 
__construct() {
        
session_set_save_handler(
            array(
$this"open"),
            array(
$this"close"),
            array(
$this"read"),
            array(
$this"write"),
            array(
$this"destroy"),
            array(
$this"gc")
        );
    }
    
    public function 
open($savePath$sessionName) {
        
$this->mc = new Memcache();
        
$this->mc->connect('127.0.0.1'11211);
        return 
true;
    }
 
    public function 
close() {
        
$this->mc->close();
        return 
true;
    }
 
    public function 
read($id) {
        return 
$this->mc->get($id);
    }
 
    public function 
write($id$data) {
        return 
$this->mc->set($id$datafalseini_get('session.gc_maxlifetime'));
    }
 
    public function 
destroy($id) {
        return 
$this->mc->delete($id);
    }
 
    public function 
gc($maxlifetime) {
    }
    
}
 
$mcsess = new SessionSaveHandler();session_start();
 
This version should not be used on production, and is provided here only for academic purposes. This can produce unpredicted results. Consider the following scenario.
* We have a page that starts with few data, asks for user login
* Login is ajax processed ** (1)
* On loging, we try to fetch the user preferences from the server ** (2)
The preferences are saved into the session
* Simulataneously a request is sent to the server to check for notifications ** (3)
Notification shown is saved into the session
Now ** (2) takes more time than ** (3) due to some reasons in the production, where as in the test environment the sequnce was okay due to the negligble latency, and low database content volume, as well as very low practical concurrent sessions. In production, a subsequent page will not see any information related to ** (3) in the session. Because, php will read the session on start of ** (2) and then write that back with the updated values when ** (2) completes processing, but ** (3) has already processed and updated the session. This is why php had a session locking. When using the sessions in file method, the locking will affect only the said session, and never affect any other session. Well though the current workaround is much high profile than the default one, still it uses the NFS as well as has the scalablitiy issues so, with the expense of some processor cycles, the above buggy code was extended to the following.

<?php
 
class SessionSaveHandler {
    protected 
$mc;
    protected 
$pid;
 
    public function 
__construct() {
        
session_set_save_handler(
            array(
$this"open"),
            array(
$this"close"),
            array(
$this"read"),
            array(
$this"write"),
            array(
$this"destroy"),
            array(
$this"gc")
        );
        
$this->pid uniqid("");
    }
    
    public function 
open($savePath$sessionName) {
        
$this->mc = new Memcache();
        
$this->mc->connect('127.0.0.1'11211);
        return 
true;
    }
 
    public function 
close() {
        
$this->mc->close();
        return 
true;
    }
 
    public function 
read($id) {
        while((
$locked $this->mc->get($id '-lck2'))){
            if(
$locked == $this->pid or $locked === false){
              break;
            }
            
usleep (10);
        }
        
$this->mc->set($id '-lck2'$this->pidfalseini_get('session.gc_maxlifetime'));
        return 
$this->mc->get($id);
    }
 
    public function 
write($id$data) {
        
$locked $this->mc->get($id '-lck2');
        if(
$locked !== $this->pid){
            return;
        }
        
$this->mc->set($id$datafalseini_get('session.gc_maxlifetime'));
        
$this->mc->set($id '-lck2'falsefalseini_get('session.gc_maxlifetime'));
        return 
true;
    }
 
    public function 
destroy($id) {
        return 
$this->mc->delete($id);
    }
 
    public function 
gc($maxlifetime) {
    }
    
}
 
$mcsess = new SessionSaveHandler();session_start();
 
This one addresses the issue and scenario outlined above by just locking the concerned browser-session. Whereas it provides the scalability as provided by Memcached pool. Theoretically this should work, and to an extend a medium level testing was conducted but still I could not get this code out into production. Since the GA releases are very stringent and this should go in the post chrismas QA release only. Anyway this being a complete detached code, I am providing the second one for download. PHP Sessions in Memcache Non Blocking (267)



20130613

tune 1

php를 pmap으로 본 결과 locate의 용량이 허더더 하더라....



기본적으로 utf-8만 사용하기 때문에 뭐 특별한 고민없이 아래와 같이 처리하였다.

# rm -rf /usr/lib/locale/locale-archive
# localedef -i en_US -f UTF-8 en_US.UTF-8

pmap으로 확인해 본 결과 메모리가 엄청나게 줄었다... ㅡㅡ;;
 

20130612

CentOS5.x에 nginx, php-fpm, mariadb, memcache, barcode 등 프로그램 설치

현재 업무 중 많은 부분이 쇼핑몰과 SCM, ERP 등이다..

평균 동접은 약 1,000명 수준이다보니 단일 서버는 어렵고 분산 처리 방식으로 개발이 된다.


그에 맞는 서버 설정을 구성하였고 기록을 남긴다.

울 회사에서 내 포지션은 개발 관련 총책임자로 있어 돈이 들어가는 걸 기본적으로 싫어하는 나는 무료/오픈 소프트웨어 로 주로 사용하며 중국에서 근무하는 상황에서 개발인력 확보가 어렵고 인건비가 상당히 비싼 점을 고려한 세팅이다.

초기 개발 시에는 JAVA도 사용하였지만 현재는 다 걷어낸 상황이다.


대략 정리하면 아래와 같다.

Language : php-fpm(web), python & shell(server inside)

OS : CentOS5.x 64bit

Software : nginx(web or proxy), php,  python, memcache, mmonit, munin, sphinx, mysql or mariadb, imagemagick, genbarcode(barcode), ioncube, goaccess


설치 과정.

1. 우선 CentOS 설치시에 모든 패키지를 제거하고 최소화로 하여 설치를 진행한다.


2. 64bit를 기준으로 설치하였기 때문에 32bit 소프트웨어는 제거.
 # yum remove \*.i\?86

3. yum 으로 설치되는 부분이 있기 때문에 yum.conf 에다가 64bit 소프트웨어만 설치하도록 32bit 소프트웨어는 exclude 처리한다.
# vi /etc/yum.conf

exclude = *.i?86  #add exclude


4. yum으로 기본 패키지 정리.
#  yum -y remove php httpd mysql bind dhclient tftp inetd xinetd ypserv telnet-server rsh-server vsftpd tcsh nfs* samba tftp-server telnet system-config-printer
#  yum -y install system-config-date subversion gcc gcc-c++ g++ cpp make ncurses-devel automake autoconf tcl-devel rdate rsync pcre-devel gd-devel zlib zlib-devel curl curl-devel libcurl-devel openssl openssl-devel libopenssl-devel libtermcap-devel libc-client-devel bzip2-devel

5.ulmiit 설정
# ulimit -SHn 10240
# echo "ulimit -SHn 10240" >> /etc/rc.local

6. imagemagick 설치
# yum -y install ImageMagick*

7. iconv 설치 (source)
# tar zxvf libiconv-1.14.tar.gz
# cd libiconv-1.14
# ./configure --prefix=/usr/local
# gmake
# gmake install
# export LD_PRELOAD=/usr/local/lib/preloadable_libiconv.so

8. mysql or mariadb 설치 (2013년 이전에는 주변에서 데이터베이스 컨설팅 시에 돈 없으면 mysql을 사용하고 아주 아주 잘 설계하면 아주 아주 잘 버텨준다고 했다. 2013년 이후엔 mariadb를 추천해주고 있다. 이유는 explain 을 해보라. 그러면 알 것이다. 어차피 실 서비스는 정규화 설계로는 답없는 경우가 대부분이다.)


# groupadd mysql
# useradd -s /bin/false -g mysql mysql


8.1 mysql 설치 시... (5.6.x 기준)
# tar xvfz mysql-5.6.x.tar.gz
# cd mysql-5.6.x
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DMYSQL_TCP_PORT=3306 -DENABLE_DTRACE=0


 8.2 mariadb 설치 시 (10.x.x 기준)
# tar xvfz mariadb-10.x.x.tar.gz
# cd mariadb-10.x.x
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL__ADDR=/tmp/mysql.sock -DSYSCONFDIR=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DMYSQL_TORT=3306 -DENABLE_DTRACE=0

mysql과 mariadb는 cmake 까지만 다르다..

# gmake
# gmake install
# echo /usr/local/mysql/lib >> /etc/ld.so.conf && ldconfig

설정 파일은 알아서 잘...(여기에 올려진 설정은 메모리 16GB기준의 서버의 설정이다)

# cp example.cnf /usr/local/mysql/my.cnf
# cp support-files/mysql.server /usr/local/mysql/bin/


# chmod 700 /usr/local/mysql/bin/mysql.server
# chown mysql. -R /usr/local/mysql
# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

관리할 폴더 생성
# mkdir /usr/local/mysql/logs
# chmod 755 /usr/local/mysql/tmp
# chmod 755 /usr/local/mysql/logs
# chown -R mysql. /usr/local/mysql

링크 생성
# ln -s /usr/local/mysql/bin/mysql /usr/bin/


# echo "/usr/local/mysql/bin/mysql.server start" >> /etc/rc.local

# /usr/local/mysql/bin/mysql.server start
# /usr/local/mysql/bin/mysql_secure_installation


mysql이나 mariadb의 설치는 동일하다고 보면 된다.



replication (필요시...)
master 에서 실행
# show master status;

slave 에서 실행.
# CHANGE MASTER TO
 MASTER_HOST='master ip',
 MASTER_USER='마스터에 접속할 계정',
 MASTER_PASSWORD='마스터에 접속할 비밀번호',
 MASTER_LOG_FILE='마스터에서 정보 조회 후 설정',
 MASTER_LOG_POS=마스터에서 정보 조회 후 설정;

# START SLAVE;
Slave에서 err를 확인하여 아래의 메시지가 있으면 접속 성공
Slave I/O thread: connected to master 'useid@hostname:3306',replicat
ion started in log 'mysql-bin.00000x' at position xxx




9. php 설치

# tar zxvf php-5.x.x.tar.gz
# cd php-5.x.x
# yum -y install libxml2-devel libpng-devel freetype-devel freetype2-devel gmp-devel libmcrypt libmcrypt-devel gd libjpeg-devel glibc glibc-devel glib2 glib2-devel GeoIP*
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-iconv=/usr/local \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --enable-gd-native-ttf \
--with-mcrypt --with-curl --with-gmp --with-zlib --with-openssl --with-pear --with-bz2 \
--enable-mbstring --enable-mbregex --enable-bcmath --enable-inline-optimization -enable-sockets \
--enable-fpm

# gmake
# gmake install

# mkdir /usr/local/php/logs

# cp php.ini-production /usr/local/php/etc/php.ini
# rm -rf /usr/bin/php
# ln -s /usr/local/php/bin/php /usr/bin/

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# vim /usr/local/php/etc/php-fpm.conf (알아서설정)

# echo "/usr/local/php/sbin/php-fpm" >> /etc/rc.local

# vim /usr/local/php/etc/php.ini (알아서설정)
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"

# /usr/local/php/sbin/php-fpm



10. ioncube loader 설치 (소스 중에 주요부분은 사용하고 있어서 사용. 근데 이거 은근 메모리 많이 먹는다.)

# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
# tar xfz ioncube_loaders_lin_x86-64.tar.gz
# mv ioncube /usr/local/

# vim /usr/local/php/etc/php.ini
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3.so (추가)
date.timezone = Asia/Shanghai (수정)





php 재시작
# killall php-fpm
# /usr/local/php/sbin/php-fpm


11. Zend 설치 (근데 요즘 사용안 하기 때문에 열외)

#  tar xvfpz ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
# mkdir /usr/local/zend/
# cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/zend/

# vi /usr/local/php/etc/php.ini

[Zend]
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_extension=/usr/local/zend/ZendGuardLoader.so

php 재시작
# killall php-fpm
# /usr/local/php/sbin/php-fpm







12. nginx 설치
# tar xzvf nginx-1.x.x.tar.gz
# cd nginx-1.x.x/

# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --with-http_geoip_module --with-http_realip_module --with-http_image_filter_module

# gmake
# gmake install
# echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local
# vim /usr/local/nginx/conf/nginx.conf (알아서 설정)

# /usr/local/nginx/sbin/nginx


13. GepIP
# yum -y install GeoIP GeoIP-devel GeoIP-data perl-Geo-IP
   
# vim /usr/local/nginx/conf/nginx.conf 에 추가
geoip_country /var/lib/GeoIP/GeoIP.dat;

해당 가상호스트 설정 부분의 php 설정에 추가
fastcgi_param  COUNTRY $geoip_country_code;


14. 바코드 설치

# wget http://mirror.yongbok.net/gnu/barcode/barcode-0.98.tar.gz
# tar xfvz barcode-0.98.tar.gz
# cd barcode-0.98
# ./configure
# gmake
# gmake install
# ldconfig

# wget http://www.ashberg.de/php-barcode/download/files/genbarcode-0.4.tar.gz
# tar xvfz genbarcode-0.4.tar.gz
# cd genbarcode-0.4
# gmake
# gmake install

php 예제....
# wget http://www.ashberg.de/php-barcode/download/files/php-barcode-0.4.tar.gz
# tar xvfpz php-barcode-0.4.tar.gz
# cd php-barcode-0.4


15. munin 설치 (nginx, php, mysql, mariadb 등의 plugin은 알아서들 설치)
# rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
# yum install munin-node -y
# vim /etc/munin/munin-node.conf
# chkconfig munin-node on
# /etc/init.d/munin-node start


16. monit 설치 (munin 이 정상적으로 잘 돌고 있는 지 감시의 목적)
# tar xvfz monit-x.y.z.tar.gz
# cd monit-x.y.z
# ./configure --prefix=/usr/local/monit
# gmake
# gmake install


17. goaccess 설치
# wget http://sourceforge.net/projects/goaccess/files/0.4.2/goaccess-0.4.2.tar.gz/download
# ./configure
# make
# make install

18. sphinx 설치... (이건 워낙 확장들이 많아서... 난 우선 중국에 있어 sphinx-chinese 를 사용)

참조 http://www.sphinx-search.com/ 여기 가면 친절히 설명이 되어있다.




tune 하는 부분은 따로 포스트 할 생각이다.


위의 내용은 아주아주 기본적인 설치이며... pmap으로 각 process를 모니터링 & 튠해야 한다.




Articles