// you’re reading...

FreeBSD

XCache 安裝

XCache 是套華人所撰寫的 PHP opcode cacher,在速度上的表現真的是讓人驚豔的軟體,網路上應該可以看到不少對它的讚賞 :D

其實早就知道這套軟體,但最終還是因為自己懶,所以一直都沒去安裝。最近心血來潮,才把它裝上去 XD  主機的OS分別有 Windows 和 FreeBSD ,在這邊就先紀錄一下安裝的紀錄。


FreeBSD:

# cd /usr/ports/www/xcache ; make install clean

Windows:
 這邊指得是複製到你 php 安裝的 extension 資料夾下。

複製 php_xcache.dll 到 c:\php5\ext 下

 接著把 xcache.ini 的設定,複製到 php.ini 裡。

XCache 的設定:

[xcache-common]
;; 安裝成 zend extension (建議), 一般的格式 "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/\
;non-debug-non-zts-xxx/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/\
;non-debug-zts-xxx/xcache.so
;; Windows 的設法是把 xcache.so 改成 php_xcache.dll
;zend_extension_ts = "D:\Server\php\ext\php_xcache.dll
;; 或者安裝成 extension, 當然要確定你的 extension 資料夾要設定好。
; extension = xcache.so
;; Windows 設法:
; extension = php_xcache.dll

[xcache.admin]
xcache.admin.user = "ib_admin"
; 可以先用 md5 -s (你要的密碼) 來生出下面那串
xcache.admin.pass = 30a968885551f66565bc60efd84be750

[xcache]
; ini only settings, all the values here is default unless explained

; select low level shm/allocator scheme implemenation
xcache.shm_scheme = "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
; 雖然說可以支援到用 64M,但依我現在的使用狀況,調大太網站就會不能顯示。
; 不知道是不是使用 unstable 版本的關係。

xcache.size = 4M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
; 幾個 CPU 就填幾個幾個上去,官網是不建議把 HT 模擬出來的當成一個 CPU 來算。

xcache.count = 2
; just a hash hints, you can always store count(items) > slots
xcache.slots = 8K
; ttl of the cache item, 0=forever
xcache.ttl = 600
; 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 的命名變數,這邊可以省略不理它。

xcache.var_size = 2M
xcache.var_count = 1
xcache.var_slots = 8K
; default ttl
xcache.var_ttl = 600
xcache.var_maxttl = 3600
xcache.var_gc_interval = 300

xcache.test = Off
; N/A for /dev/zero
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory.
; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection
; 2 group of php won’t share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path

xcache.mmap_path = "/dev/zero"

; leave it blank(disabled) or "/tmp/phpcore/"
; make sure it’s writable by php (without checking open_basedir)

xcache.coredump_directory = "D:\web\xcache\tmp"

; per request settings
xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off

[xcache.coverager]
; per request settings
; enable coverage data collecting for xcache.coveragedump_directory and
; xcache_coverager_start/stop/get/clean() functions (will hurt executing performance)

xcache.coverager = On

; ini only settings
; make sure it’s readable (care open_basedir) by coverage viewer script
; requires xcache.coverager=On

xcache.coveragedump_directory = "D:\web\xcache\tmp"

在一台有 1G 記憶體的 Windows 2003 上,xcache.size 只要超過 4M 就會無法正常顯示 … 詳細的設定可能還需要再研究一下。

Discussion

No comments for “XCache 安裝”

Post a comment