apc,xcache的安装配置

张映 发表于 2010-05-05

分类目录: cache

标签:,

apc,xcache,eaccelerator都能够缓存opcode的php中间码,从而起到对php加速的作用,以前写过一篇关于eaccelerator的文章,请参考http://blog.51yip.com/php/172.html   apc,xcache,eaccelerator安装方法都一样,不同的是参数设置不一样而已

一,apc安装配置
wget http://pecl.php.net/get/APC-3.1.2.tgz
tar zxvf APC-3.1.2.tgz
cd APC-3.1.2/
/usr/local/php/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php/bin/php-config
make
make install

修改php.ini
查找extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
下面添加 extension = "apc.so" 配置php.ini 末尾加入
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 32
apc.ttl = 600
apc.user_ttl = 600
apc.num_files_hint = 0
apc.write_lock = On

二,xcache安装配置
wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
tar zxvf xcache-1.2.2.tar.gz
cd xcache
/usr/local/php/bin/phpize
./configure --enable-xcache --enable-xcache-mmap --with-php-config=/usr/local/php/bin/php-config
make
make install

修改php.ini
查找extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
下面添加 extension = "xcache.so" 配置php.ini 末尾加入
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so

[xcache.admin]
xcache.admin.auth = On
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = ""

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =               32M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =              3600
xcache.gc_interval =         300

; Same as aboves but for variable cache
; If you don't know for sure that you need this, you probably don't
xcache.var_size  =            0M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300
; N/A for /dev/zero
xcache.readonly_protection = Off
xcache.mmap_path =    "/dev/zero"
xcache.cacher =               On
xcache.stat   =               On

这三个加速都对opcode的php中间码对行缓存的,能不能同时使用,没有尝试过,不过eacc和apc,我同时使用过,不过有问题。网上有关于这三者加速的比较,查一下好多,有了就省得我来比较了。写的挺不错的。自己搜一下吧。



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/cache/731.html

留下评论

留下评论
  • (必需)
  • (必需) (will not be published)
  • (必需)   1X9=?