1: PHP xcache xcache-admin 설치 (install) / comfile
RHEL/CentOS 파일 다운로드 및 컴파일 진행
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz # tar xvfz xcache-3.2.0.tar.gz # cd xcache-3.2.0 # /usr/local/php/bin/phpize # ./configure --enable-xcache --enable-xcache-coverager --with-php-config=/usr/local/php/bin/php-config # make # make install |
관리자 tool을 보기위해 파일 복사
1 |
# cp -a htdocs /usr/local/xcache |
2: 환경설정 파일 수정 (php.ini)
1 |
# vi /usr/local/apache/conf/php.ini ( 각 server의 php.ini 경로에 맞게 구성) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
[xcache-common] extension = xcache.so [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "admin" ; set xcache.admin.pass = md5($your_password) ; login use $your_password xcache.admin.pass = "3a8256f9b7c8972de2810bf24584217f" [xcache] xcache.shm_scheme = "mmap" ; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows xcache.size = 512M ; set to cpu count (cat /proc/cpuinfo |grep -c processor) xcache.count = 4 ; just a hash hints, you can always store count(items) > slots xcache.slots = 8K ; ttl of the cache item, 0=forever xcache.ttl = 0 ; interval of gc scanning expired items, 0=no scan, other values is in seconds xcache.gc_interval = 0 ; same as aboves but for variable cache xcache.var_size = 128M xcache.var_count = 4 xcache.var_slots = 8K ; default value for $ttl parameter of xcache_*() functions xcache.var_ttl = 0 ; hard limit ttl that cannot be exceed by xcache_*() functions. 0=unlimited xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.var_namespace_mode = 0 xcache.var_namespace = "" ; N/A for /dev/zero xcache.readonly_protection = Off xcache.mmap_path = "/dev/zero" ; Useful when XCache crash. leave it blank(disabled) or "/tmp/phpcore/" (writable by php) xcache.coredump_directory = "" ; Windows only. leave it as 0 (default) until you're told by XCache dev xcache.coredump_type = 0 ; disable cache after crash xcache.disable_on_crash = Off ; enable experimental documented features for each release if available xcache.experimental = Off ; per request settings. can ini_set, .htaccess etc xcache.cacher = On xcache.stat = On xcache.optimizer = Off [xcache.coverager] xcache.coverager = Off xcache.coverager_autostart = On ; set in php ini file only xcache.coveragedump_directory = "" |
각 서버 환경에 맞게 적당하게 구성한다
count 항목은 CPU 코어갯수를 입력하면 된다.
만약 간단하게 구성하려면 (xcache_var 항목 제외)
1 |
# vi /usr/local/apache/conf/php.ini ( 각 server의 php.ini 경로에 맞게 구성) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[xcache-common] extension = xcache.so xcache.admin.enable_auth = On xcache.admin.user = "admin" xcache.admin.pass = "3a8256f9b7c8972de2810bf24584217f" [xcache] xcache.shm_scheme = "mmap" xcache.size = 512M xcache.count = 4 xcache.slots = 8K xcache.ttl = 0 xcache.gc_interval = 0 xcache.readonly_protection = Off xcache.mmap_path = "/dev/zero" xcache.coredump_directory = "" xcache.coredump_type = 0 xcache.cacher = On xcache.stat = On xcache.optimizer = Off [xcache.coverager] xcache.coverager = Off xcache.coverager_autostart = On xcache.coveragedump_directory = "" |
각 서버 환경에 맞게 적당하게 구성한다
count 항목은 CPU 코어갯수를 입력하면 된다.
3: 웹서버 재시작
1 2 |
# killall -9 httpd # apachectl start |
4: PHP 모듈 정상 확인
1 |
# php -v |
1 2 3 4 5 6 7 8 |
[root@xinet xcache]# php -v PHP 5.3.29 (cli) (built: Nov 19 2014 09:43:57) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies with XCache v3.2.0, Copyright (c) 2005-2014, by mOo with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo |
정상적으로 설치된 것을 확인 할수 있다
이제 웹에서 파일을 확인해보자
1 2 3 4 |
vi /free/home/xinet/html/info.php <?php phpinfo(); ?> |
5: xcache 관리 (admin tool) 접속을 위한 설정
1 2 3 4 5 |
# vi test.php <? echo md5("123456"); ?> |
php test.php 실행 ( 아래 항목을 복사한다)
1 2 |
#[root@localhost xinet]# php test.php e10adc3949ba59abbe56e057f20f883e |
다시 xcache.ini 파일을 열어서 내용 수정
1 2 3 4 5 6 |
# vi /usr/local/apache/conf/php.ini [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "admin" xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e" |
관리자 tool 웹에서 볼수 있게 내용 httpd.conf에서 내용 수정
(특정 아이피에서 접속허용)
1 2 3 4 5 6 7 8 9 10 11 12 |
# vi /usr/local/apache/conf/httpd.conf Alias /xcache /usr/local/xcache <Directory /usr/local/xcache> Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from 192.168.10.2 112.216.x.x (내용수정) #Allow from All (특정 아이피가 아닌 모든 client 에서 보려면 이 옵션 사용) </Directory> |
웹주소창에 http://xinet.kr/xcache
1 |
http://xinet.kr/xcache |